SQL Shorts - SELECT DISTINCT Statement (Learn new SQL Concepts in 5 minutes)
- The SELECT DISTINCT statement is used to only return distinct or unique values in a particular selected column.
SELECT DISTINCT column_name
FROM table_name
Examples:
Q). Find distinct names of people from the city Onionpur
Here, the query can be as follows:
SELECT DISTINCT names
FROM Onionpur
Q) Select distinct names from the table: students
Here, our query can be as follows:
SELECT DISTINCT name
FROM students
Points to remember:
- DISTINCT is used to select unique values in a column.
Comments
Post a Comment