Description
The SQL keyword SELECT DISTINCT is used to fetch only the distinct or different values in the result set.
- It will not return duplicate values.
- The DISTINCT keyword must immediately follow the SELECT keyword in a statement.
- In the case of multiple NULL values, only one NULL value is returned considering all the NULL values as the same value.
- It is commonly used to fetch distinct values of a specific column, by mentioning the column next to the DISTINCT keyword on a SELECT statement.
The below SQL fetches the list of distinct country values from the table.
SELECT DISTINCT country
FROM customers;