Wednesday, 7 February 2018

Distinct keyword

Distinct keyword,Distinct keyword in sql,syntax of Distinct keyword,example of Distinct keyword,how to use Distinct keyword in sql.

The distinct keyword is used with Select statement to retrieve unique values from the table. Distinct removes all the duplicate records while retrieving from database.

Syntax
SELECT distinct column-name from table-name;
Example of Distinct keyword
Consider the following Student table.

s_id
s_Name
age
salary
101
Dashzin
15
5000
102
Ravi
18
4000
103
Abhinav
17
7000
104
Ankit
22
4000
105
Dashrath
17
5000
SELECT distinct salary from student;

The above query will return only the unique salary from student table                                              
salary
5000
4000
7000


DashZin

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

0 comments:

Post a Comment