Aggregating values
GQL aggregation functions are provided to compute values from a set of records, offering a range of operations to handle diverse data aggregation requirements. The basic functions include COUNT
, which counts the number of records; AVG
, for calculating averages, MAX
and MIN
, for obtaining the maximum and minimum values, respectively; and SUM
, for totaling the values. Advanced functions encompass COLLECT_LIST
, which aggregates values into a list, and statistical functions such as STDDEV_SAMP
and STDDEV_POP
for sample and population standard deviation calculations. Additionally, GQL supports binary set functions such as PERCENTILE_CONT
and PERCENTILE_DISC
, which are used for continuous and discrete percentile calculations, respectively.
Set quantifiers: DISTINCT and ALL
Before stepping into aggregation examples, it is crucial to understand set quantifiers in GQL.
DISTINCT
removes duplicates from results, while ALL
(applied implicitly when DISTINCT
is omitted...