Count
Aggregate Function
Description
Yields the number of input rows.
Click here to navigate to the PostgreSQL docs page for this syntax.
The function Count() is supported on Snowflake.
Grammar Syntax
COUNT( <expr1> [ , <expr2> ... ] )
COUNT( * )
COUNT( DISTINCT <expr1> )
Sample Source Patterns
PostgreSQL
CREATE TABLE sample (i_col INTEGER, j_col INTEGER);
INSERT INTO sample VALUES
(11,101), (11,102), (11,NULL), (12,101), (NULL,101), (NULL,102);
SELECT COUNT(*), COUNT(i_col), COUNT(j_col), COUNT(DISTINCT i_col) FROM basic_example;
Snowflake
CREATE TABLE sample (i_col INTEGER, j_col INTEGER);
INSERT INTO sample VALUES
(11,101), (11,102), (11,NULL), (12,101), (NULL,101), (NULL,102);
SELECT COUNT(*), COUNT(i_col), COUNT(j_col), COUNT(DISTINCT i_col) FROM basic_example;
Last updated
Was this helpful?