DISTINCT

The DISTINCT clause returns only unique (distinct) values from a column or a set of columns, eliminating duplicate rows in the result set.

Syntax

SELECT DISTINCT <column_name> [ ,... ]
FROM <table_name>

Arguments

Parameter

Description

column_name

The columns from which to retrieve distinct values

table_name

The table from which to retrieve the data

Examples

SELECT
  COUNT(DISTINCT department_id)
FROM
  employees;