SQL Keyword - DISTINCT

DISTINCT Keyword

The SELECT DISTINCT statement is used for returning only distinct (different) values from a column.

Syntax

SELECT DISTINCT <COLUMNS> FROM <TABLE_NAME>;

Example 1

SELECT DISTINCT * FROM Employee;

In the above example, only the different/distinct row will be displayed.

Example 2

SELECT DISTINCT Emp_Name FROM Employee;

In above example only different names will be displayed.

Summary

It is used to select only different values from the table.

Next Recommended Reading SQL Keyword - EXISTS