Select Distinct in SQL – Remove duplicate data from table

Select Distinct in SQL is used to remove the duplicate data from the table. SQL DISTINCT Keyword is used along with the SELECT statement

The SQL Distinct syntax is as follows:

SELECT DISTINCT column1, column2….
FROM table_name
WHERE [condition];

Become a Database Architect

Example:
Consider the Student_details table:

Name Roll No. Marks
Akshay 1 57
Charu 2 68
Disha 3 52
Eva 4 68

Now we want to see the marks of the students and duplicate values will no display.

SELECT DISTINCT Marks
FROM Student_details
ORDER BY Marks;
Marks
52
57
68

 

Course Schedule

Name Date
SQL Training 2021-08-07 2021-08-08
(Sat-Sun) Weekend batch
View Details
SQL Training 2021-08-14 2021-08-15
(Sat-Sun) Weekend batch
View Details
SQL Training 2021-08-21 2021-08-22
(Sat-Sun) Weekend batch
View Details

Leave a Reply

Your email address will not be published. Required fields are marked *