Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 992 Bytes

File metadata and controls

34 lines (26 loc) · 992 Bytes
description
Returns the total number of records for the specified expression.

COUNT

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

{% code title="Aggregate function example" %}

SELECT COUNT(transaction_count) 
FROM eth.recent_blocks
-- 338293677

{% endcode %}

{% code title="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

{% endcode %}