Updated on 2024-11-06 GMT+08:00

Analysis Statements - HAVING

The syntax of a complete analysis statement is as follows:

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

The HAVING syntax specifies the conditions for filtering group results (GROUP BY) or aggregation calculation results. The following part describes parameters and examples for the HAVING syntax.

Filters data based on grouping and Aggregate Functions.

SELECT age, MAX(balance) GROUP BY age HAVING MIN(balance) > 10000
Table 1 The HAVING function

age

MAX(balance)

28

32838

32

39225