DISTINCT CLAUSE

The MySQL select Distinct statement is used to retrieve unique rows (by removing the duplicate rows ) from the specified column in the select statement.

SELECT DISTINCT [Columns] FROM source
  • DISTINCT: This keyword returns Unique Columns
  • Columns: It allows us to choose you want to use from the table. It may be one or more.
  • Source: One or more tables present in the database. Use Joins to join multiple table.

We are going to use the below shown data to explain the Select Distinct in MySQL with example.

EXAMPLE:

SELECT DISTINCT course FROM student