Aggregate Functions

Aggregate functions perform a calculation on a set of values and return a single value.

  1. COUNT(expression)
  2. COUNT(*)

Return the number of rows. When expression is specified, the count returned will be the number of matched rows. When * is specified, the count returned will be the total number of rows.

  1. AVG(expression)

Return the average value of a given expression.

  1. SUM(expression)

Return the sum value of a given expression.

  1. MAX(expression)

Return the max value of a given expression.

  1. MIN(expression)

Return the min value of a given expression.

  1. TOPK(expression_value, expression_k)

Return the top K(specified by expression_k) values of expression_value in a array.

  1. TOPKDISTINCT(expression_value, expression_k)

Similar to TOPK, but only returns distinct values of expression_value.