diff --git a/doc/src/sgml/syntax.sgml b/doc/src/sgml/syntax.sgml index 67482996861..a697218c8b3 100644 --- a/doc/src/sgml/syntax.sgml +++ b/doc/src/sgml/syntax.sgml @@ -1602,11 +1602,19 @@ sqrt(2) - For example, count(*) yields the total number - of input rows; count(f1) yields the number of - input rows in which f1 is non-null, since - count ignores nulls; and - count(distinct f1) yields the number of + For example, in this query: + +WITH vals (f1) AS ( VALUES (1),(3),(4),(3),(2),(null) ) +SELECT count(*) AS total, count(f1) AS non_null, COUNT(DISTINCT f1) AS distinct +FROM vals; + total | non_null | distinct +-------+----------+---------- + 6 | 5 | 4 + + total yields the total number of input rows; + non_null yields the number of input rows in which + f1 is non-null, since count + ignores nulls; and distinct yields the number of distinct non-null values of f1.