Skip to main content
Version: 24.3.x

Categories: Aggregate, Window

COUNT

Returns the total number of records for the specified expression.

Syntax

COUNT(expression any primitive) → bigint

  • expression: The expression to evaluate the number of records. This parameter can either be * or a column name of any primitive data type. Using asterisk (*) will include rows that contain NULL. Specifying a column name will ignore rows have NULL in that column.

Examples

Aggregate function example
SELECT COUNT(passenger_count) FROM "Samples"."samples.dremio.com"."NYC-taxi-trips"
-- 338293677
Window function example
SELECT "trip_distance_mi",
COUNT("total_amount") OVER(PARTITION BY "trip_distance_mi") "count_total_amount"
FROM "Samples"."samples.dremio.com"."NYC-taxi-trips"
LIMIT 1
-- trip_distance_mi, count_total_amount
-- 0.06, 61900