--- title: "ZCQL V2 Syntax and Exceptions" url: https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/syntax-exceptions/ 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 --- # ZCQL V2 Syntax and Exceptions Catalyst has added several syntax upgrades and enhancements to help you write ZCQL queries more effectively. These new syntax upgrades will provide additional functionalities and enable you to perform data related operations in the Data Store with much ease. > **Note:** * To use these feature enhancements, you will need to migrate to the **V2** version. The syntax upgrades will not be applicable if you implement them while executing ZCQL commands in **V1**. * 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. The following exception and syntax nuances need to be kept in mind when you execute a ZCQL query: 1. The [`AVG ()`](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/zcql-functions/#avg) ZCQL function can be applied on the following data types: - **Date** - **DateTime** - **Boolean** 2. When you are indicating a value in your ZCQL statement, indicate the value in single quotes. For example, if you have to fetch a particular name from an employee database, you will write the command in the following manner: ```sql SELECT Name FROM Employee_DB WHERE name = 'Amelia' ``` 3. If a column is of Boolean data type: - No string values are permitted. - Boolean data type will only support the following values: - FALSE - TRUE - NULL 4. If you are using an **Encrypted datatype**, then the following ZCQL functions cannot be used on that column: - `AVG()` - `SUM()` - `MAX()` - `MIN()` 5. [Appropriate exceptions](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/syntax-exceptions/#list-of-zcql-exceptions) have been added when you use comparative operators like `Less Than`, `Greater Than`, `Less Than or Equal`, and `Greater Than or Equal`, on **Encrypted Text**, and **Boolean** data type. These exceptions are not applicable for `Equal` and `Not Equal` operators. 6. Subqueries are now supported in `WHERE` clause statements. You can find out more about them from this [help document](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/where/#subqueries-in-where-clause). 7. [`ORDER BY`](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/groupby-orderby/#order-by-statement) clause now supports the use of [ZCQL functions](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/zcql-functions/). 8. In all columns where you use the `ORDER BY` clause, the `ASC` and `DESC` functionality can now be applied. You can also apply `ASC` and `DESC` for individual columns. **Example Database**: Consider the following database - **ZylkerEmployeeCompensation**
Name Salary Reimbursement
Michelle Mascarenhas 90000 10000
Bruce Kyle 3000000 45000
Clark Kane 3300 1500
Judith Bridges 4700 300
Devon Dreymond 80000 2300
Ashley Kim 6000 200
Execute the following command to list the table ```sql SELECT Salary, Reimbursement FROM ZylkerEmployeeCompensation ORDER BY Salary ASC, Reimbursement DESC ``` **Output:**
ZylkerEmployeeCompensation.Salary ZylkerEmployeeCompensation.Reimbursement
3300 45000
4700 10000
6000 2300
80000 1500
90000 300
3000000 200
9. [Appropriate exceptions](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/syntax-exceptions/#list-of-zcql-exceptions) will be triggered in the following cases: - If the permitted max/min value has been exceeded in **Integer** datatype. - If the character length is longer than the value set by you in **VarChar** datatype. - If the value is beyond the supported range in **BIGINT** datatype. 10. You can write **four** [`JOIN`](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/joins/) clauses in a single ZCQL statement. However, you can only write **one** `JOIN` condition for each join clause. 11. **Table Alias** functionality is now supported in ZCQL. You can now invoke alias functionality in ZCQL using the `AS` ZCQL command. Using this command you can refer to your table with other names. **Example Database**: Consider the following databases: **Table 1: ZylkerEmployeeCompensation**
Name Salary Reimbursement
Michelle Mascarenhas 90000 10000
Bruce Kyle 3000000 45000
Clark Kane 3300 1500
Judith Bridges 4700 300
Devon Dreymond 80000 2300
Ashley Kim 6000 200
**Table 2: ZylkerEmployeeRelation**
Manager Member
Michelle Mascarenhas Bruce Kyle
Michelle Mascarenhas Clark Kane
Judith Bridges Michelle Mascarenhas
Execute the following command to list the table ```sql SELECT Managers.Name, Members.Name FROM ZylkerEmployeeCompensation AS Managers INNER JOIN ZylkerEmployeeRelation AS asso ON Managers.ROWID = asso.Manager INNER JOIN ZylkerEmployeeCompensation AS Members ON Members.ROWID = asso.Member ``` **Output:**
Manager.Name Member.Name
Michelle Mascarenhas Bruce Kyle
Michelle Mascarenhas Clark Kane
Judith Bridges Michelle Mascarenhas
> **Note:** The table Alias operation is only supported for `SELECT` statements. 12. You can check if you have a NULL value by using the **IS/IS NOT** operator. The **IS/IS NOT** operator support is only available for NULL values. 13. When writing [`GROUP BY`](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/groupby-orderby/) with [`Binaryof()`](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/groupby-orderby/#binaryof-function) statements, the following ZCQL rules need to be remembered: - The Binaryof() functionality can only be used in GROUP BY statements. - Binaryof() can only be used on columns with VarChar or Text datatype. - When Binaryof() is used in a GROUP BY statement, the returned values are case-sensitive. For example, consider you have the values 'AMELIA', 'amelia', 'Burrows', and 'burrows' in a column called Name, in a table called Zylker_EMP. If you use the following command: ```sql Select Name from Zylker_EMP group by binaryof(Name) ``` The result could be any of the following: - AMELIA - amelia - burrows - Burrows 14. Column names can now contain numerical values. You can signify such column names in the query using a backtick (**`**) punctuation. For example, a `SELECT` query on a table called Numbers with a column named 01 can be written in the following manner: ```sql SELECT `01` FROM Numbers ``` ### List of ZCQL Exceptions The following is a list of common exceptions and example query statements that can trigger these exceptions. Ensure that you go through the list, and follow ZCQL syntax strictly to avoid triggering these exceptions.
Datatype Case Sample ZCQL Query Triggered Exception
Encrypted Text Certain operators are not supported SELECT * FROM temp WHERE enc > 'temsp' `Operator > is not supported for ENCRYPTED TEXT` The same exception applies, but the exception message will be altered accordingly if you use these operators **<**, **<=**, **>=** in the ZCQL statement
`LIKE` is not supported SELECT * FROM temp WHERE enc LIKE '*temsp' `Operator LIKE is not supported for ENCRYPTED TEXT` The same exception applies, but the exception message will be altered accordingly if you use **NOT LIKE** in the ZCQL statement
`BETWEEN` is not supported SELECT * FROM temp WHERE enc BETWEEN 'one' AND 'ten' `Operator BETWEEN is not supported for ENCRYPTED TEXT` The same exception applies, but the exception message will be altered accordingly if you use **NOT BETWEEN** in the ZCQL statement
`IN` is not supported SELECT * FROM temp WHERE enc IN ('one','three') `Operator IN is not supported for ENCRYPTED TEXT` The same exception applies if you use **NOT IN** in your query, but the exception message will be altered accordingly
ZCQL functions is not supported SELECT AVG(enc) FROM temp `AVG() function is not supported for ENCRYPTED_TEXT` [ZCQL Functions](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/zcql-functions/) are not supported in **Encrypted Text**.
Boolean Certain operators are not supported SELECT * FROM temp WHERE bools > FALSE `Operator > is not supported for BOOLEAN` The same exception applies, but the exception message will be altered accordingly if you use these operators **<**, **<=**, **>=** in the ZCQL statement
`LIKE` is not supported SELECT * FROM temp WHERE bools LIKE FALSE `Operator LIKE is not supported for BOOLEAN` The same exception applies if you use **NOT LIKE** in your query, but the exception message will be altered accordingly
`BETWEEN` is not supported SELECT * FROM temp WHERE bools BETWEEN TRUE and FALSE `Operator BETWEEN is not supported for BOOLEAN` The same exception applies if you use **NOT BETWEEN** in your query, but the exception message will be altered accordingly
`IN` is not supported SELECT * FROM temp WHERE bools IN (TRUE, FALSE) `Operator IN is not supported for BOOLEAN` The same exception applies if you use **NOT IN** in your query, but the exception message will be altered accordingly
VarChar Maximum length exceeded INSERT INTO temp (Fishes) value ('salmon') `'salmon' data too long for column 'Fishes'` The column `Fishes` was created as a **VarChar** and the **MaxLength** was set as `5`. In this statement, `'Salmon'` exceeds the **MaxLength**
Integer Maximum value exceeded INSERT INTO temp (numbers) VALUE (546895326908) `For column 'ints' INT value should be between -9999999999 and 9999999999` The column numbers was created as **INT**. The value of **INT** datatype should be between `-9999999999` and `9999999999`
Big Integer Maximum value exceeded INSERT INTO temp (numbers) VALUE (92343432412351 435123453245) `Given numeric value 92343432412351 435123453 is too large` The column numbers was created as **BIGINT**. The value of **BIGINT** datatype should be between `-9223372036854775808` and `9223372036854775807`
Text Value not enclosed in single quotes SELECT * FROM temp WHERE name = one `Unknown Table temp or Unknown Column one in WHERE` The value `one` will be considered as column if it is not enclosed in quotes-'`one`'