Count the number of values within the requested window.

For more information on usage, please refer to Window Functions

Syntax

COUNT( <value> ) OVER ( [ PARTITION BY <partition_by> ] )

Parameters

ParameterDescriptionSupported input types
<value>A value used for the COUNT() function.Any numeric type
<partition_by>An expression used for the PARTITION BY clause.Any

Return Type

NUMERIC

Example

The following example generates a count of how many video game players have registered on a specific day:

SELECT
	registeredon,
	COUNT(agecategory) OVER (PARTITION BY registeredon) AS count_of_players
FROM
	players;

Returns:

registeredoncount_of_players
2020-11-1512
2020-11-168
2020-11-174
2020-11-189