sql / beginner
Snippet
Retrieving Unique Values
The DISTINCT keyword is used in a SELECT statement to remove duplicate rows from the result set. It ensures that each returned value is unique.
snippet.sql
1
2
SELECT DISTINCT departmentFROM staff;
Breakdown
1
SELECT DISTINCT department
Instructs the database to return only unique entries found in the department column.
2
FROM staff
Indicates the source table for the query.