SQL Distinct Keyword

0
154

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
Facebook Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here

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