On this page

Show all

HAVING

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]

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.

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

age

MAX(balance)

28

32838

32

39225

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback