In some times we want to find out the unique(different) entries from a single database table column. In this situation SQL helps us through DISTINCT keyword. DISTINCT is nothing but, it gives the different entries from a single table column. It does not allows the duplicate entries with the result.
let us assum below table that contains the contact informations about the students. table name is students_information
| student_id | name | address | location | city |
| ST101 | stalin | #4b,k street | west mambalam | Chennai |
| ST102 | arun | #46A,appolo street | west mambalam | Chennai |
| ST103 | anjelina | #23b,h street | T.Nagar | Chennai |
| ST104 | ishvarya | #4b,3rd street | mandaveli | Chennai |
Executed Query:
select distinct location from students_information
Result :
| location |
| west mambalam |
| T.Nagar |
| mandaveli |
Description:
The location list will show the student location that where are from our students. location name cant repeat the list. because of DISTNICT keyword. It cant allow duplicate values.