Distinct Clause in SQL

Distinct Clause in SQL is used to fetch only unique values and remove the duplicate values from the result.

Key – Points :

The changes made by Distinct Clause are not permanent and are not written on disk.These changes are temporarily done in buffer.

Distinct Clause is used in SELECT Statement.

Distinct Clause can be applied to single column or combination of columns.

Syntax :

Distinct Clause for a single column :

SELECT DISTINCT(<Col>) FROM <Tablename>;

Brackets are optional.

Distinct Clause when applied to a single column fetc

Distinct Clause for a multiple columns :

SELECT  DISTINCT  <Col 1> , <Col 2 >….<Col n>  FROM <Tablename>;

Shikha Katariya

Shikha

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *