Monday, 29 May 2017

DBMS DISTINCT keyword ~ GNIITHELP

Distinct keyword

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 for DISTINCT Keyword

SELECT distinct column-name from table-name;

Example

Consider the following Emp table.
eidnameagesalary
401Anu225000
402Shane298000
403Rohan3410000
404Scott4410000
405Tiger358000
select distinct salary from Emp;
The above query will return only the unique salary from Emp table
salary
5000
8000
10000

No comments:

Post a Comment