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(transaction_count) 
FROM eth.recent_blocks
-- 338293677
Window function example
SELECT "base_fee_per_gas",
  COUNT("total_gas_used") 
  OVER(PARTITION BY "base_fee_per_gas") "count_total_gas_used"
FROM eth.recent_blocks
LIMIT 1

-- base_fee_per_gas, count_total_gas_used
-- 0.06, 61900

Last updated