Esta página aún no está disponible en su idioma local. Estamos trabajando arduamente para agregar más versiones de idiomas. Gracias por tu apoyo.

On this page

Show all

Aggregate Functions

Updated on 2025-01-20 GMT+08:00

The syntax of a complete analysis statement is as follows:

1
2
3
4
SELECT [DISTINCT] (* | expression) [AS alias] [, ...]
[GROUP BY expression [, ...] [HAVING predicates]]
[ORDER BY expression [ASC | DESC] [, ...]]
[LIMIT size OFFSET offset]

This section describes some aggregate functions.

Table 1 Aggregate functions

Function

Purpose

Description

Example Value

avg

Average value

avg(number T) -> T

SELECT avg(age) LIMIT 1

sum

Sum

sum(number T) -> T

SELECT sum(age) LIMIT 1

min

Specifies the minimum value.

min(number T) -> T

SELECT min(age) LIMIT 1

max

Maximum value

max(number T) -> T

SELECT max(age) LIMIT 1

count

Occurrences

count(field) -> integer ,

count(*) -> integer ,

count(1) -> integer

SELECT count(age) LIMIT 1 ,

SELECT count(*) LIMIT 1 ,

SELECT count(1) LIMIT 1

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback