SQL Distinct Keyword

0
283

sqltuts

SQL Distinct Keyword

The SQL Distinct Keyword is mainly used with the Select statement in order to get unique values from the desired table. Distinct removes all the redundant records while retrieving from the database.

The syntax for DISTINCT Keyword

Example

Consider the following consumer table.

Consumer id name age salary
10 rajat 20 90000
11 karan 45 85000
12 ram 37 67000
21 Shyam 41 85000
23 jon 33 90000

 

The above query will return only the unique salary from consumer table

salary
85000

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.