🐘SELECT DISTINCT
Describe about Select Distinct command
The DISTINCT
clause is used in the SELECT
statement to remove duplicate rows from a result set.
Evaluate one or multiple column by DISTINCT
SELECT DISTINCT column1, column2 FROM table_name;
// If you do like this it will wrap the value with 2 column for checking duplicate
//example It can query like this
|--column1--|--column2--|
| test1 | test2 |
| test1 | test3 |
-----------------------
Evaluate specific column by DISTINCT
SELECT DISTINCT ON (column1) , column2 FROM table_name;
// It will return only this one from previos table
|--column1--|--column2--|
| test1 | test2 |
-----------------------
Last updated