SQL Distinct Keyword

0
171

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
Previous articleSQL Temporary Tables
Next articleSQL GROUP BY Statement
Hello Itsourcecoders, welcome to itsourcecode.com. I'm Joken Villanueva, MIT a passionate Blogger, Programmer and a Hobbyist. I started Itsourcecode because I wanted to give back and Share all the learnings and knowledge I've learned in my career and I believe through this website I would be able to help and assist those newbie programmers in enhancing their skills from different programming languages. So let us all help each other by sharing our ideas!

Leave a Reply

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