On this page

Show all

HAVING

Updated on 2022-11-18 GMT+08:00

HAVING

HAVING is used with aggregate functions and GROUP BY to control which groups are selected. HAVING filters out groups that do not meet specified conditions after grouping and aggregation calculation.

Example:

SELECT count(*), mktsegment, nationkey,
CAST(sum(acctbal) AS bigint) AS totalbal
FROM customer
GROUP BY mktsegment, nationkey
HAVING sum(acctbal) > 5700000
ORDER BY totalbal DESC;
Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback