Unique values
Let's assume we have the following table
sales
country | city | amount | |
---|---|---|---|
1 | Poland | Warsaw | 13 |
2 | Germany | Berlin | 24 |
3 | Poland | Katowice | 56 |
And we would like to know all of the countries that the product was sold.
If we use the normal query we know: SELECT country from sales
it will return Poland Germany Poland
. This is not what we are looking for because Poland is repeated twice.
To solve it we can use the DISTINCT
keyword:
SELECT DISTINCT country FROM sales
No Comments