Intro
Let’s get a distinct list of countries in our database. We can do this in two ways:
Example 1
SELECT DISTINCT COUNTRY FROM music.Users;
Example 2
SELECT
COUNTRY
FROM music.Users
GROUP BY
COUNTRY;
Both these examples return the same result set. So why use one over the other?
- Example 1 is less verbose.
- Example 2 can be used with aggregation functions