Skip to content

COUNT(DISTINCT)

Return the number of distinct non-NULL values for an expression.

COUNT(DISTINCT expression)

For example:

premdb=# SELECT COUNT(DISTINCT winners) FROM season;
 count 
-------
    6
(1 row)

Aggregate functions are supported as both regular aggregate functions and aggregate window functions. See also COUNT (window function).

Parent topic:Aggregate Functions