Distinct

SQL DISTINCT

The DISTINCT is used into a select query to eliminate duplicate records and returns the unique values.

Syntax

SELECT DISTINCT name_of_column FROM name_of_table;

Example

Table of books

ID NAME PRICE
1 Learn Python 45
2 MySQL Tutorial 32
3 PHP examples 24
4 Learn SQL 32
SELECT DISTINCT price FROM books;

Output

PRICE
45
32
24