Title - DISTINCT SQL query Tags - sql programming datanalysis
DISTINCT is used to return rows with unique values in a particular column. Using SELECT without DISTINCT will return rows with duplicate data. E.g.
SELECT tools FROM inventory;
Might produce:
tools Hammer Nails Nails Nails
On the other hand,
SELECT DISTINCT tools FROM inventory;
Would produce:
tools Hammer Nails
By filtering out duplicate values, DISTINCT makes it easier to see the data you need.
DISTINCT can also be used to query multiple columns. This may return data with the same value in each column, but every row will be unique.