Sql, Keyword
The SQL DISTINCT keyword is used in conjunction with the SELECT statement to eliminate all the duplicate records and fetching only unique records.
Distinct returns a unique set of values in a select statement. In fact, very old Oracle used “unique” instead of “distinct”. In Simple words distinct removes duplication from the data.
Let say we have dept id column in emp table which has the following data
10
20
10
30
20
Now we run a query with distinct and see the difference
select distinct dept id from emp;
10
20
30