SELECT DISTINCT
DISTINCT returns each different value only once. It works on the combination of all selected columns.
Example
SELECT DISTINCT country
FROM students;Result
country Nigeria Ghana Kenya South Africa
Example
SELECT COUNT(DISTINCT country) AS countries
FROM students;Result
countries 4
Exercise
Return each country only once.
SELECT country FROM students;
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.