SELECT DISTINCT statement is used to fetch only the distinct (different) data from a table.
Syntax:
SELECT DISTINCT column1, column2 FROM table_name; SAMPLE STUDENTS TABLE:
| Roll_No | Name | Marks |
| 1 | Dev | 35 |
| 2 | Ayush | 45 |
| 3 | Ram | 55 |
| 4 | Pyush | 55 |
| 5 | Nazim | 75 |
Example: To fetch distinct marks students from the students table.
SELECT Roll_No, Name FROM students; In students table Ram and Pyush have same marks to it will return only one of the row:
| Roll_No | Name | Marks |
| 1 | Dev | 35 |
| 2 | Ayush | 45 |
| 4 | Pyush | 55 |
| 5 | Nazim | 75 |