

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The distinct keyword is a crucial component of sql (structured query language) used in database management systems to retrieve unique values from a table. The syntax and usage of the distinct keyword with examples, demonstrating how it removes duplicate records while retrieving records from a table. This knowledge is essential for database administrators, data analysts, and developers.
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!


The distinct keyword is used with SELECT statement to retrieve unique values from the table. Distinct removes all the duplicate records while retrieving records from any table in the database. Syntax for DISTINCT Keyword SELECT DISTINCT column-name FROM table-name; Example using DISTINCT Keyword Consider the following Emp table. As you can see in the table below, there is employee name , along with employee salary and age. In the table below, multiple employees have the same salary, so we will be using DISTINCT keyword to list down distinct salary amount, that is currently being paid to the employees. eid name age salary
401 Anu 22 5000 402 Shane 29 8000 403 Rohan 34 10000 404 Scott 44 10000 405 Tiger 35 8000 SELECT DISTINCT salary FROM Emp; The above query will return only the unique salary from Emp table. sala ry 5000 8000 1000