SELECT DISTINCT

SQL SELECT DISTINCT Keyword

The SELECT DISTINCT command is used to return only unique (different) values from a column or combination of columns in the result set.

Tutorials dojo strip

SQL SELECT DISTINCT Syntax

SELECT DISTINCT column1, column2, ...
FROM table_name;

SQL SELECT DISTINCT Single Column Example

This query selects unique gender values from the Patients table.

SELECT DISTINCT gender
FROM Patients;

SQL SELECT DISTINCT Multiple Columns Example

This query selects unique combinations of doctor_id and specialty from the Doctors table.

SELECT DISTINCT doctor_id, specialty
FROM Doctors;

SQL SELECT DISTINCT Labs

Tutorials dojo strip
Scroll to Top