--- title: "HAVING Clause" url: https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/having/ description: "ZCQL is Catalyst's own query language modelled after familiar query languages that you can use to query your app's database efficiently." last_updated: 2026-08-28T06:26:16Z service: Cloud Scale type: general --- # HAVING Clause ### Introduction The `HAVING` clause is used to select data records based on a specified condition. You can also apply [ZCQL functions](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/zcql-functions/) in the query using this clause. The `HAVING` clause can only be used with [`SELECT`](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/select/) queries. The syntax for using the `HAVING` clause is shown below: ```sql SELECT column_name FROM base_table_name GROUP BY column_name HAVING column_name OPERATOR condition ``` ### Operators Supported by the HAVING Clause You can use the following operators in the `HAVING` conditions in ZCQL `SELECT` queries:
Operators Description
= Equal to
IS TRUE if the operand is the same as the value
IS NULL TRUE if the operand is a null value
IS NOT NULL TRUE if the operand is not a null value
=! Not equal to
LIKE TRUE if the operand matches a pattern
NOT LIKE TRUE if the operand does not match a pattern
BETWEEN TRUE if the operand value is between the start and end values
IN TRUE if the operand is equal to a list of expressions
NOT IN TRUE if the operand is not equal to a list of expressions
> Greater than
>= Greater than or equal to
< Lesser than
<= Lesser than or equal to
### ZCQL Functions with HAVING Clause [ZCQL functions](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/zcql-functions/) like `SUM()`, `COUNT()`, `AVG()`, etc., can be used with the `HAVING` clause in a `SELECT` query. **Example Database**: The employee details of Zylker Technologies are being maintained in the [Data Store](https://docs.catalyst.zoho.com/en/cloud-scale/help/data-store/introduction/) in the *Zylker_Employee_DB* table. The table contains the following columns and rows:
ID Name Department Salary
ZT-001 Amelia Burrows Product Management 15000
ZT-2001 Bruce Wayne Sr. Management 85000
ZT-239 Clark Kane Media Relations 85000
ZT-4289 Michelle Mascarenhas Finance 89000
Let's use the [`AVG()`](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/zcql-functions/#avg) ZCQL function, with the `HAVING` clause in an example `SELECT` query. ```sql SELECT Name, Department, Salary FROM Zylker_Employee_DB GROUP BY Department HAVING AVG(Salary) > 50000 ```
Zylker_Employee_DB.Salary Zylker_Employee_DB.Department Zylker_Employee_DB.Name
85000 Sr. Management Bruce Wayne
89000 Finance Michelle Mascarenhas
> **Note:** * This functionality is only available in **ZCQL V2**. * From **December 01st, 2024**, all your current projects in all your [Orgs](https://docs.catalyst.zoho.com/en/getting-started/catalyst-organizations/) present in the [Development Environment](https://docs.catalyst.zoho.com/en/deployment-and-billing/environments/development-environment/) will be automatically mapped to **ZCQL V2 Parser**. * From **April 01st, 2025**, all the projects present in all *Orgs* that have already been mapped to **ZCQL V2 Parser** in *Development Environment* will be automatically mapped to **ZCQL V2 Parser** in the [Production Environment](https://docs.catalyst.zoho.com/en/deployment-and-billing/environments/production-environment/), if and when production is enabled for the project.