ARRAY_COUNT_GLOBAL
Reference material for ARRAY_COUNT_GLOBAL function
Returns the number of elements in the array column accumulated over all rows. As such it is an aggregation function.
Syntax
Parameters
Parameter | Description | Supported input types |
---|---|---|
<array> | The array column over which the function will count the elements. | Any ARRAY type |
Return Type
INTEGER
Example
For this example, we will create a table levels
as shown below. This table will highlight the levels that a certain player has completed.
We can use ARRAY_COUNT_GLOBAL
to learn how many total array elements are in all rows for the user esimpson
.
Returns: 17
If you want to count elements based on specific criteria, you can use the ARRAY_COUNT function with a SUM
aggregation as demonstrated below.
Returns: 11