# ZCQL -------------------------------------------------------------------------------- title: "Introduction" 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-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/introduction/" service: "CloudScale" -------------------------------------------------------------------------------- # ZCQL ## Introduction Catalyst CloudScale ZCQL serves as Catalyst’s own query language, similar to [MySQL](https://www.mysql.com/) or [PostgreSQL](https://www.postgresql.org/). It is used to perform data manipulations within the [Catalyst Data Store](https://docs.catalyst.zoho.com/en/cloud-scale/help/data-store/introduction/). As a query engine powered by Catalyst, ZCQL enables developers to work with data using familiar SQL-like syntax while handling complex queries with high efficiency and scalability. You can perform the following operations on the tables in your Data Store using ZCQL: * **Retrieval:** Obtaining records from existing tables * **Insertion:** Inserting records into the existing columns of an existing table * **Updating:** Updating the value of existing columns in an existing table * **Deletion:** Deleting records from an existing table You can execute a variety of DML queries using ZCQL to obtain or manipulate data based on specific criteria by using various clauses and statements such as the SQL `Join` clauses, `Groupby` statements, `OrderBy` statements, and the `WHERE` and `HAVING` clauses. ZCQL also supports several built-in SQL numeric functions that help you execute arithmetic operations easily. You can implement ZCQL queries in your Catalyst application's source code, such as in the functions or the client component. For example, you pass a ZCQL query in a function's body to retrieve data from a table in the Data Store and process it further. The Catalyst console also provides a ZCQL query execution window, where you can execute queries and view the responses. This allows you to test ZCQL queries easily, before implementing them in your application. ### SDK and API documentation Catalyst offers ZCQL in the Java, Node.js, Python, Web, Android, iOS, and Flutter SDK packages, and as an API. For code samples on executing ZCQL queries in these programming environments, refer to these help pages: * [Execute ZCQL Query - Java SDK](https://docs.catalyst.zoho.com/en/sdk/java/v1/cloud-scale/zcql/execute-zcql-query/) * [Execute ZCQL Query - Node.js SDK](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/zcql/execute-zcql-query/) * [Execute ZCQL Query - Python SDK](https://docs.catalyst.zoho.com/en/sdk/python/v1/cloud-scale/zcql/execute-zcql-query/) * [Execute ZCQL Query - Web SDK](https://docs.catalyst.zoho.com/en/sdk/web/v4/cloud-scale/zcql/execute-zcql-query/) * [Execute ZCQL Query - Android SDK](https://docs.catalyst.zoho.com/en/sdk/android/v2/cloud-scale/zcql/execute-zcql-query/) * [Execute ZCQL Query - iOS SDK](https://docs.catalyst.zoho.com/en/sdk/ios/v2/cloud-scale/zcql/execute-zcql-query/) * [Execute ZCQL Query - Flutter SDK](https://docs.catalyst.zoho.com/en/sdk/flutter/v2/cloud-scale/zcql/execute-zcql-query/) * [Execute ZCQL Query - API](https://docs.catalyst.zoho.com/en/api/code-reference/cloud-scale/zcql/execute-zcql-query/#ExecuteZCQLQuery) > **Note:** * 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. * To use **ZCQL V2** in your code, you need to set the appropriate environment variable as shown in this [help document](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/zcql-console/#using-zcql-v2-in-function-code). You can refer to [Catalyst Tutorials](https://docs.catalyst.zoho.com/en/tutorials/) to get an idea of ZCQL's implementation in the function or client code of the applications. ### Benefits * Can perform data retrieval, insertion, updating, and deletion operations in the Catalyst Data Store * Similarity to MySQL ensures ease of use and there is no separate learning curve * Can test the execution of the queries in the console before implementing them in the application * Can pass a ZCQL query in an API's body using the SDKs * Can perform arithmetic and numerical operations on the result set using the ZCQL built-in functions -------------------------------------------------------------------------------- title: "General Syntax of SELECT" 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-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/select/" service: "CloudScale" -------------------------------------------------------------------------------- # SELECT ### General Syntax of SELECT ZCQL supports data retrieval query operations using the `SELECT` command. This command lets you select a column or a set of columns from a base table and view the data records within the command's scope. The general syntax for a basic ZCQL data retrieval operation is as follows: ```sql SELECT {COLUMNS} FROM {BASE_TABLE_NAME} [JOIN_CLAUSE] [WHERE {WHERE_CONDITION}] [GROUP BY {GROUP_BY_COLUMN}] [ORDER BY {ORDER_BY_COLUMN}] LIMIT [{OFFSET}],{VALUE} ``` > **Note:** * The base table is the table you execute the query on. * You need not use the end-of-statement delimiter (;) at the end of a ZCQL query, while executing it in the ZCQL console. The base table is the table you execute the query on. We will discuss each ZCQL operation in detail with an example database and sample queries that you can execute on it. **Example Database:** Imagine you're developing a ticket booking application where users can view the movie listings and showtimes for various theaters in a city, and can book movie tickets using the application. Let's create a table named '**Movies**' that contains the showtime listings of the movies played in various theaters. Sample records from the _Movies_ table are given below:
MovieID MovieName ShowDate ShowTime TheaterID
2056 The First Purge 2018-07-13 13:00:00 047
2057 Ant-Man and the Wasp 2018-07-13 14:20:00 052
2058 Hotel Transylvania 3: Summer Vacation 2018-07-14 17:00:00 052
2059 Skyscraper 2018-07-14 21:30:00 053
### Basic SELECT The `SELECT` statement is used to select the columns from a base table and display its records. You should mention the names of the columns that are to be displayed in the result set. The syntax for using a basic `SELECT` statement is: ```sql SELECT column_name(s) FROM base_table_name ``` **Example**: To select the _MovieID_ and _MovieName_ columns from the _Movies_ table, execute the following query: ```sql SELECT MovieID, MovieName from Movies ``` It will generate the following output:
MovieID MovieName
2056 The First Purge
2057 Ant-Man and the Wasp
2058 Hotel Transylvania 3: Summer Vacation
2059 Skyscraper
For columns that have been named using integers, you need to add the backtick **`** punctuation to differentiate between column name and value. 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 ``` > **Note:** You can fetch a maximum of 30 columns and a maximum of 300 rows in one `SELECT` query. If you require more records to be fetched, you can use the [LIMIT clause](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/limit/) to iterate the query and specify the offset and value accordingly. ### SELECT \* You can fetch records from all the columns of a base table, instead of selecting records from a particular column or columns, by using a '\*' following the `SELECT` statement. The '\*' denotes all the columns of the base table. The syntax for selecting all the columns from a base table is: ```sql SELECT * FROM base_table_name ``` > **Note:** `SELECT \*` allows you to fetch a maximum of 300 rows in one query. If you require more records to be fetched, you can use the [LIMIT clause](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/limit/) to iterate the query and specify the offset and value accordingly. **Example**: To display the records from all the columns of the _Movies_ table, execute the following query: ```sql SELECT * FROM Movies ``` This will display records from all the columns in the _Movies_ table.
MovieID MovieName ShowDate ShowTime TheaterID
2056 The First Purge 2018-07-13 13:00:00 047
2057 Ant-Man and the Wasp 2018-07-13 14:20:00 052
2058 Hotel Transylvania 3: Summer Vacation 2018-07-14 17:00:00 052
2059 Skyscraper 2018-07-14 21:30:00 053
Before we discuss the various clauses and statements available for the `SELECT` operation, let's discuss the `INSERT`, `UPDATE`, and `DELETE` operations. -------------------------------------------------------------------------------- title: "General Syntax of INSERT" 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-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/insert/" service: "CloudScale" -------------------------------------------------------------------------------- # INSERT ### General Syntax of INSERT You can insert a record in a table by passing the values for each column of that table for that record. The general syntax of a basic ZCQL data insertion operation is as follows: ```sql INSERT INTO {BASE_TABLE_NAME} VALUES (VALUE1, VALUE2,..) ``` You must pass the values in the same order as the columns are present in the table. > **Note:** * Ensure that you provide the right value for a column that matches the column's data type. * For columns where the _IsUnique_ constraint is enabled, ensure that you don't enter values that are already present in other records. Similarly, for the columns where the _IsMandatory_ validator is enabled, ensure that you do not leave the data value blank. * For a column where the data type is a **Foreign Key**, you must provide the ROWID of the parent table's record which it refers, as its value. **Example:** To insert a record in the _Movies_ table, execute the following query: ```sql INSERT INTO Movies VALUES (2060,'Mission: Impossible – Fallout', '2018-7-27', '16:00:00', 053) ``` > **Note:** If the values to be inserted are **String values**, you must pass the values enclosed in single quotations as shown above. ### Partial Insert You can also pass values only for specific columns in a table by specifying the column names which the values need to be inserted for. The syntax for a partial insert is as follows: ```sql INSERT INTO {BASE_TABLE_NAME} (COLUMN_NAME1, COLUMN_NAME2,..) VALUES (VALUE1, VALUE2,..) ``` To insert a record and pass values for the _MovieID_ and _TheaterID_ columns alone in the _Movies_ table, execute the following query: ```sql INSERT INTO Movies (MovieID, TheaterID) VALUES (2061, 052) ``` -------------------------------------------------------------------------------- title: "General Syntax of UPDATE" 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-11-03T15:41:32.000Z" source: "https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/update/" service: "CloudScale" -------------------------------------------------------------------------------- # UPDATE ### General Syntax of UPDATE The `UPDATE` command enables you to update specific column values of existing records of a table in the Data Store. You can update the values of columns based on certain conditions. These conditions can be specified using the [`WHERE` clause](), which we will discuss later on in detail. The general syntax of a basic ZCQL data updation operation is as follows: ```sql UPDATE {BASE_TABLE_NAME} SET {COLUMN_NAME}={VALUE}[WHERE {WHERE_CONDITION}] ``` > **Note:** * Ensure that you provide the right value for a column that matches the column's data type. * For columns where the _IsUnique_ constraint is enabled, ensure that you don't enter values that are already present in other records. Similarly, for the columns where the _IsMandatory_ validator is enabled, ensure that you do not leave the data value blank. * For a column where the data type is a **Foreign Key**, you must provide the ROWID of the parent table's record which it refers, as its value. **Example:** To update the value of a specific movie name referred to by its _MovieID_ in the _Movies_ table, execute the following query: ```sql UPDATE Movies SET MovieName='The Equalizer 2'WHERE MovieID=2056 ``` > **Note:** Similar to data insertion, if the values to be updated are String values, you must pass the values enclosed in single quotations. -------------------------------------------------------------------------------- title: "General Syntax of DELETE" 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-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/delete/" service: "CloudScale" -------------------------------------------------------------------------------- # DELETE ### General Syntax of DELETE The `DELETE` command enables you to delete one or more records from a table permanently. You can indicate the records to be deleted using the [`WHERE` clause](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/where/), which is explained in the next section, and specify the conditions. The general syntax of a basic `DELETE` statement is as follows: ```sql DELETE FROM {BASE_TABLE_NAME}[WHERE {WHERE_CONDITION}] ``` **Example:** To delete the record of a specific show date in a particular theater from the Movies table, you can execute this query: ```sql DELETE FROM Movies WHERE MovieID=2059 AND ShowDate='2018-07-14' AND TheaterID=053 ``` > **Note:** If you specify a string value in the `WHERE` condition, you must pass it enclosed in a single quotation. -------------------------------------------------------------------------------- title: "WHERE Clause" 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-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/where/" service: "CloudScale" -------------------------------------------------------------------------------- # WHERE Clause ### Introduction The `WHERE` clause is used to filter the data records on the basis of a specified condition or a set of conditions in the search queries. When the WHERE condition is used in a query, the data records are verified based on the specified conditions, and the commands are executed only on the records that satisfy the conditions. For example, the syntax for using the `WHERE` condition in a `SELECT` statement is: ```sql SELECT column_name(s) FROM base_table_name WHERE condition ``` The `WHERE` condition can be used with the `UPDATE` and `DELETE` statements as well. ### Operators Supported by the WHERE Clause You can use the following operators in the `WHERE` conditions in ZCQL 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
**Example**: To view a list of the movies that are screened on days other than July 13, 2018 from the Movies table, you can specify the date condition in the query using the `WHERE` clause in the following way: ```sql SELECT MovieName, ShowDate FROM Movies WHERE ShowDate IS '2018-07-14' ``` This will generate the following output:
MovieName ShowDate
Hotel Transylvania 3: Summer Vacation 2018-07-14
Skyscraper 2018-07-14
### Multiple WHERE Conditions You can specify a maximum of five WHERE conditions in a single query. When multiple `WHERE` conditions are specified, you can use either an `AND` or an `OR` operator to link the conditions together. The functionalities of the `AND` and `OR` operators are: * `AND`: Produces only the data records that satisfy both of the conditions that are associated with the `AND` operator. * `OR`: Produces the data records that satisfy either of the conditions that are associated with the `OR` operator. For example, the syntax for using multiple `WHERE` conditions in a `SELECT` statement is: ```sql SELECT column_name(s) FROM base_table_name WHERE condition_1 AND|OR condition_2.. AND|OR condition_5 ``` **Example**: To view a list of the show dates and show times from the _Movies_ table for either 'The First Purge' or 'Skyscraper' movies that are screened on July 14, execute the following query: ```sql SELECT MovieName, ShowDate, ShowTime FROM Movies WHERE MovieName='The First Purge' OR MovieName='Skyscraper' AND ShowDate='2018-07-14' ``` There is only one record that matches the above conditions. The query will therefore generate the following result:
MovieName ShowDate ShowTime
Skyscraper 2018-07-14 21:30:00
### LIKE Statement The `LIKE` condition enables you to indicate records which contain a specific criteria and select all records that match that condition. For example, you can indicate a specific alphabet that the records you require to be fetched must begin with, or a particular value that they must contain. For example, the syntax of the `LIKE` condition in an `UPDATE` statement is as follows: ```sql UPDATE base_table_name SET column_name(s)=value(s) WHERE condition LIKE *value* ``` The '\*' can be used either before or after, or both before and after, the value that you specify. The '\*' is essentially a placeholder that indicates that any value can be replaced in its stead. For example, to indicate that all records in a table that begin with the alphabet 'A' must be fetched, you can enter the `LIKE` value as 'A\*'. This specifies that after the letter A, any values can follow. **Example:** To update the records where the movie names begin with the letter 'S' in the _Movies_ table, execute the following query: ```sql UPDATE Movies SET ShowDate='2018-07-17' WHERE MovieName like 'S*' ``` This will update the following record and set the value:
MovieID MovieName ShowDate ShowTime TheaterID
2059 Skyscraper 2018-07-17 21:30:00 053
Wildcard syntax and symbols such as **\*** and **?** are also permitted to be used in ZCQL statements defined using the `LIKE` condition statement.
Wildcard Syntax Definition
`\*` Matches zero or more characters
`?` Matches exactly one character
### BETWEEN Statement The `BETWEEN` condition enables you to filter records by indicating the starting and ending values in a particular column containing numerical values. For example, you can select all the records where the percentage values are between 70 and 80. For example, the syntax of a `BETWEEN` condition in a `DELETE` statement is as follows: ```sql DELETE FROM base_table_name WHERE condition BETWEEN Value1 AND Value2 ``` > **Note:** You can use the `BETWEEN` statement only for selecting 'Int' or 'Double' values in the Catalyst Data Store table. You will not be able to use it for any other data types. **Example:** To delete the records where the value of the MovieID is between 2056 and 2059 in the _Movies_ table, execute the following query: ```sql DELETE FROM Movies WHERE MovieID BETWEEN 2056 AND 2059 ``` The following records from the table will be deleted:
MovieID MovieName ShowDate ShowTime TheaterID
2057 Ant-Man and the Wasp 2018-07-13 14:20:00 052
2058 Hotel Transylvania 3: Summer Vacation 2018-07-14 17:00:00 052
> **Note:** To produce the exact opposite result, you can use the `NOT BETWEEN` statement. The same syntax and conditions of a `BETWEEN` statement applies to `NOT BETWEEN` statements. ### Column to Column Comparison You can compare two columns of the same table or in different tables by **referring to the column names with their respective table names** in the LHS and RHS of the comparison. The result of the comparison will return the rows that contain the same value for column1 and column2 in the table. This comparison support in `WHERE` clause is applicable to the `SELECT`, `UPDATE` and `DELETE` queries. You can compare any two columns that are of the following data types : `BOOLEAN`, `DOUBLE`, `DATE`, `DATETIME`, `ENCRYPTED`, `VARCHAR`, `TEXT`, `INT` and `BIGINT`. > **Note:** You cannot compare columns of two different data types. **SELECT:** The general syntax for column comparison within the same table is as follows: ```sql SELECT * FROM tablename WHERE columnname1 = tablename.columnname2 ``` **Example**: ```sql Select MovieName FROM Movies WHERE Actor = Movies.Producer ```
MovieName
The White River Kid
Duplex
Oppenheimer
**UPDATE:** ```sql UPDATE Movies SET self_produced = "Yes" WHERE Actor = Movies.Producer ``` **DELETE:** ```sql DELETE FROM Movies WHERE Actor = Movies.Producer ``` #### Comparison of Columns in Different Tables You can also compare columns of two different tables as shown in the syntax below : ```sql SELECT tablename1.columnname1, tablename2.columnname1 FROM tablename2 LEFT JOIN tablename1 ON tablename2.columnname1 = tablename1.columnname2 WHERE tablename1.columnname1 = tablename2.columnname2 ``` **Example**: ```sql SELECT Movies.name, Theatres.city from Theatres left join Movies on Theatres.ROWID = Movies.theatreID where Movies.distributionCity = theatre.city ```
Name City
Dark Knight Rises Los Angeles
Titanic New York
Similarly, you can compare columns belonging to two different tables while executing the `UPDATE` and `DELETE` queries. ### Subqueries in WHERE Clause A subquery is a query that is written inside another query statement. Catalyst enables you to execute simple singular subqueries with `WHERE` clause. You can write subqueries with the `WHERE` clause in `SELECT`, `UPDATE` and `DELETE` queries. The syntax of a subquery with `WHERE` clause is given below: ```sql SELECT column_name FROM table_name WHERE column_name operator (SELECT column_name FROM table_name) ``` **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
An example subquery statement to list the salaries and the names of the employees who earn greater than the minimum salaried employee is given below: ```sql SELECT Name, Salary FROM Zylker_Employee_DB WHERE Salary > (SELECT MIN (Salary) FROM Zylker_Employee_DB) ```
Zylker_Employee_DB.Salary Zylker_Employee_DB.Name
15000 Amelia Burrows
85000 Bruce Wayne
89000 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. -------------------------------------------------------------------------------- title: "HAVING Clause" 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-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/having/" service: "CloudScale" -------------------------------------------------------------------------------- # 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. -------------------------------------------------------------------------------- title: "JOIN Clause" 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-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/joins/" service: "CloudScale" -------------------------------------------------------------------------------- # JOIN Clause ### Introduction The `JOIN` clause is used to combine rows from two or more tables in a `SELECT` query, based on a related column between them. The rows from all the tables are generated together with the common column merged. Before we learn more about the `JOIN` clause, let's understand a few key terms related to joins: 1. **Primary Key:** A primary key is a unique identifier of a record in a table. A table can have one column as its primary key column, and the value for each record in this column must be unique, is mandatory, and cannot be duplicated. 2. **Foreign Key**: A foreign key column in one table uniquely identifies a row in another table or the same table. The foreign key of the second table refers to the primary key of the first table. 3. **Parent Table**: In the `JOIN` clause, the parent table is the base table that the join is performed based on. 4. **Join Table**: The join table is the secondary table or the child table which is being merged with the parent table in the `JOIN` clause. > **Note:** Joins between two tables are only possible if there is a relationship between them. One of the tables must refer to the other table's primary key column, so either the join table must have a foreign key column of the parent table, or the parent table must have a foreign key column of the join table. In our example, the _MovieID_ column is the primary key of the _Movies_ table as it holds the unique identification number of a movie. **Example Database:** Let's create a table named "Theaters" in the ticket booking application which specifies the locations of all the theaters that are registered with the application. Sample records from the **Theaters** table are given below:
TheaterID TheaterName Location
047 The Express Cinemas New York City
048 ANC Cinemas Rochester
052 Cosmos Theater Albany
053 FunTime Cinemas Buffalo
The _TheaterID_ column is the primary key of the _Theaters_ table as it holds the unique identification numbers of the theaters. The _TheaterID_ column in the _Movies_ table is the foreign key to the _TheaterID_ column in the _Theaters_ table. > **Note:** When you use a `JOIN` clause, you must specify the column names and their table names for each column in the query as: **'_table\_name.column\_name_'**'. For example: '_Movies.MovieName_', '_Theaters.Location_' If you don't specify the table name with the column name in a query, then by default it is considered to be a column in the base table. ### Types of Joins There are two types of Joins that can be performed in ZCQL. #### INNER JOIN The `INNER JOIN` returns the records that have matching values in both the parent table and the join table. When you use an inner join on two tables, only the records whose values match for the specified columns in both the tables are produced as the output. The syntax for using an `INNER JOIN` is: ```sql SELECT column_name(s) FROM parent_table_name INNER JOIN join_table_name ON parent_table_name.column_name = join_table_name.column_name ``` **Example:** To view a list of the movie names, show dates, and show times from the _Movies_ table along with the theater names from the _Theaters_ table, execute the following query: ```sql SELECT Movies.MovieName, Theatres.TheaterName, Movies.ShowDate, Movies.ShowTime, FROM Movies INNER JOIN Theatres ON Movies.TheaterID = Theatres.TheaterID ``` This will generate the following output:
MovieName TheaterName ShowDate ShowTime
Ant-Man and the Wasp The Express Cinemas 2018-07-13 13:30:00
Hotel Transylvania 3: Summer Vacation Cosmos Theater 2018-07-13 14:20:00
The First Purge Cosmos Theater 2018-07-14 17:00:00
The First Purge FunTime Cinemas 2018-07-14 21:30:00
#### LEFT JOIN The `LEFT JOIN` returns all the records from the parent table and the matched records from the join table. When you use a left join on two tables, all records from the parent table are returned, even if they do not have matches from the join table. The result is displayed as 'NULL' for records that do not have a match in the join table. The syntax for using a `LEFT JOIN` is: ```sql SELECT column_name(s) FROM parent_table_name LEFT JOIN join_table_name ON parent_table_name.column_name = join_table_name.column_name ``` **Example:** To view a list of theaters and their locations from the _Theaters_ table along with the movies that are being screened in the theaters from the _Movies_ table, execute the following query: ```sql SELECT Theaters.TheaterName, Theaters.Location, Movies.MovieName FROM Theaters LEFT JOIN Movies ON Theaters.TheaterID = Movies.TheaterID ``` This will generate the following output:
TheaterName Location MovieName
The Express Cinemas New York City The First Purge
ANC Cinemas Rochester NULL
Cosmos Theater Albany Hotel Transylvania 3: Summer Vacation
FunTime Cinemas Buffalo Skyscraper
Since there are no matching records for ANC Cinemas in the Movies table, the result is displayed as 'NULL'. ### Multiple Joins You can combine a maximum of **four** joins in a single ZCQL query. However, you can only write **one** `JOIN` condition for each join clause. This will display the results from four different tables, where one is linked to another using an `INNER JOIN` or a `LEFT JOIN`. **Example Database**: Let's create a table called 'Pricing' in the ticket booking application which displays the ticket price in dollars of a single ticket for a particular movie and theater. This table references _TheaterID_ from the _Theaters_ table and _MovieID_ from the _Movies_ table as the foreign keys. Sample records from the **Pricing** table are given below:
TheaterID MovieID Price
047 2056 9.20
048 NULL NULL
052 2057 8.64
052 2058 11.50
053 2059 7.44
You can execute a query to display the _TheaterName_ from the _Theaters_ table, _MovieName_, _ShowDate_, and _ShowTime_ from the _Movies_ table, and _Price_ from the _Pricing_ table, by executing the following query: ```sql SELECT Theaters.TheaterName,Movies.MovieName, Movies.ShowDate, Movies.ShowTime, Pricing.Price FROM Pricing LEFT JOIN Movies ON Theaters.TheaterID = Movies.TheaterID INNER JOIN Theaters ON Movies.MovieID = Pricing.MovieID ``` This will generate the following output:
TheaterName MovieName ShowDate ShowTime Price
The Express Cinemas The First Purge 2018-07-13 13:00:00 9.20
ANC Cinemas NULL NULL NULL NULL
Cosmos Theater Ant-Man and the Wasp 2018-07-13 14:20:00 8.64
Cosmos Theater Hotel Transylvania 3: Summer Vacation 2018-07-14 17:00:00 11.50
FunTime Cinemas Skyscraper 2018-07-14 21:30:00 7.44
> **Note:** * To utilize all the features of the `JOIN` clause, we recommend you migrate your codebase from **ZCQL V1** to **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. * You can learn more on the enhancements and features of **ZCQL V2** from this [help document](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/syntax-exceptions/). -------------------------------------------------------------------------------- title: "GROUP BY and ORDER BY" 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-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/groupby-orderby/" service: "CloudScale" -------------------------------------------------------------------------------- ### GROUP BY Statement The `GROUP BY` statement is used to group the records fetched in a search query results by one or more columns. `GROUP BY` enables identical data to be grouped together and displayed sequentially. When there are duplicate values in a column, the `GROUP BY` statement displays the duplicates together. The records are then ordered based on other columns. The `GROUP BY` statement is associated with the `SELECT` statement and is often used with [ZCQL functions](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/zcql-functions/). It is used towards the end of the query and should therefore satisfy the `JOIN` statements and follow the `WHERE` conditions. The basic syntax for using a `GROUP BY` statement along with the `SELECT` statement is as follows: ```sql SELECT column_name(s) FROM parent_table_name GROUP BY column_name(s) ``` **Example**: To view a list of theaters and their locations from the _Theaters_ table, grouped by the location of the theaters, execute the following query: ```sql SELECT TheaterName, Location FROM Theaters GROUP BY Location ``` This will generate the following output:
TheaterName Location
Cosmos Theater Albany
FunTime Cinemas Buffalo
The Express Cinemas New York City
ANC Cinemas Rochester
#### BINARYOF() Function The `BINARYOF()` function can only be used in a `GROUP BY` statement. The function can be used in places where you wish to produce an output that is not case sensitive and considers all the values in a column of a table. The `BINARYOF()` function can only be used on columns with **VarChar** or **Text** datatype. For example, consider the following table *Zylker_EMP*:
Names
AMELIA BURROWS
amelia burrows
amelia Burrows
Amelia Burrows
An example ZCQL statement to illustrate the functionality of `BINARYOF()` and its possible output is given below: ```sql SELECT Names FROM Zylker_EMP GROUP BY BINARYOF(Names) ```
Zylker_EMP.Names
AMELIA BURROWS
amelia burrows
amelia Burrows
Amelia Burrows
> **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. ### ORDER BY Statement The `ORDER BY` statement is used to sort the records fetched in a search query results in an ascending or a descending order, based on one or more columns. When the `ORDER BY` statement is used to sort textual data, it sorts the records in the alphabetical order. Similar to the `GROUP BY` statement, the `ORDER BY` statement is associated with the `SELECT` statement and is often used after the `GROUP BY` statement. It is used towards the end of the query, after the `JOIN` clause statements or the WHERE conditions, if present, but before the `LIMIT` clause. The `ORDER BY` statement should then satisfy the `JOIN` statements and follow the `WHERE` conditions. > **Note**: If the `ORDER BY` statement follows a GROUP BY statement, the `ORDER BY` statement takes precedence and the results are ordered first based on the `ORDER BY` statement, and then grouped together based on the `GROUP BY` statement. * If there are duplicate values in a column, the `ORDER BY` statement will display the duplicates together. The records are then ordered based on other columns. * [ZCQL Functions](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/zcql-functions/) can also be used with `ORDER BY` statements. > **Note:** To utilize all the features of the `ORDER BY` statement, we recommend you migrate your codebase from **ZCQL V1** to **ZCQL V2**. You can learn more on the enhancements and features of **ZCQL V2** from this [help document](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/syntax-exceptions/) The basic syntax for using a `ORDER BY` statement with the `SELECT` statement is as follows: ```sql SELECT column_name(s) FROM parent_table_name ORDER BY column_name(s) [ASC | DESC] ``` > **Note:** * By default, the `ORDER BY` statement sorts the records in ascending order without using the keyword '`ASC`'. To sort the records in a descending order, you will have to use the keyword '`DESC`'. * 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**: To view a list of the ticket prices from the Pricing table in descending order for each movie from the _Movies_ table execute the following query: ```sql SELECT Movies.MovieName, Pricing.Price FROM Movies INNER JOIN Pricing ON Movies.MovieID = Pricing.MovieID ORDER BY Pricing.Price DESC ``` This will generate the following output:
MovieName Price
Hotel Transylvania 3: Summer Vacation 11.50
The First Purge 9.20
Ant-Man and the Wasp 8.64
Skyscraper 7.44
-------------------------------------------------------------------------------- title: "LIMIT Clause" 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-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/limit/" service: "CloudScale" -------------------------------------------------------------------------------- ### LIMIT Clause The `LIMIT` clause limits the number of data records that are displayed in the result set of a search query. It contains the following properties: 1. **`OFFSET`: OFFSET defines the starting index of the result, i.e., the first record's position that will be displayed in the result. 2. `VALUE`**: VALUE defines the number of records to be retrieved from the starting index, i.e., the `OFFSET`. The `LIMIT` clause identifies the `OFFSET` index and then displays the number of records as specified in the `VALUE` from the `OFFSET` index. You can also just specify the value without specifying the offset, when the starting index is the first record. The `LIMIT` clause is only used when a specific number of records is to be displayed. It is used towards the end of the query after all the other clauses and statements. The basic syntax for using the `LIMIT` clause with a `SELECT` statement is: ```sql SELECT column_name(s) FROM parent_table_name LIMIT OFFSET, VALUE ``` **Example**: To view a list of the movies from the _Movies_ table consisting of up to three records from the second starting index execute the following query: ```sql SELECT * FROM Movies LIMIT 1,3 ``` It will generate the following output:
MovieID MovieName ShowDate ShowTime TheaterID
2057 Ant-Man and the Wasp 2018-07-13 14:20:00 052
2058 Hotel Transylvania 3: Summer Vacation 2018-07-14 17:00:00 052
2059 Skyscraper 2018-07-14 21:30:00 053
-------------------------------------------------------------------------------- title: "ZCQL Functions" 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-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/zcql-functions/" service: "CloudScale" -------------------------------------------------------------------------------- # ZCQL Functions ZCQL supports some mathematical and analytical built-in functions that help you perform quick arithmetic operations on the data and manipulate the result set of a search query to meet your requirements. These functions are used in the `SELECT` statement for the columns that are generated in the output. ### MIN() The `MIN()` function returns the minimum value of the selected column. You can use it to return the smallest value of a column that contains numerical data or the record that comes first in the alphabetical order. The basic syntax for using a `MIN()` function along with the `SELECT` statement is: ```sql SELECT MIN(column_name) FROM base_table_name ``` **Example**: To view the least expensive movie from the _Pricing_ table, execute the following query: ```sql SELECT MIN(Price) FROM Pricing ``` This will generate the following output:
MIN(Price)
7.44
### MAX() The `MAX()` function returns the maximum value of the selected column. You can use it to return the largest value of a column that contains numerical data or the record that comes last in the alphabetical order. The basic syntax for using a `MAX()` function with the `SELECT` statement is: ```sql SELECT MAX(column_name) FROM base_table_name ``` **Example**: To view the most expensive movie from the _Pricing_ table, execute the following query: ```sql SELECT MAX(Price) FROM Pricing ``` This will generate the following output:
MAX(Price)
11.50
### COUNT() The `COUNT()` function returns the value for the number of rows in the records that are returned for a particular column in the output. The `COUNT` function is also used with the `SELECT` statement. The basic syntax for using a `COUNT()` function with the `SELECT` statement is: ```sql SELECT COUNT(column_name) FROM base_table_name ``` **Example:** To view the number of theaters in New York City and Albany, from the _Theaters_ table, execute the following query: ```sql SELECT COUNT(TheaterName) FROM Theaters WHERE Location='New York City' OR Location='Albany' ``` This will generate the following output:
COUNT(TheaterName)
2
### SUM() The `SUM()` function calculates and returns the total sum of a numeric column's records. This can only be used for a column that contains numerical data. The `SUM()` function can also be used with the `SELECT` statement for a singular column. The basic syntax for using a `SUM()` function with the `SELECT` statement is: ```sql SELECT SUM(column_name) FROM base_table_name ``` **Example**: To view the sum total of the ticket charges for 'The First Purge' and 'Hotel Transylvania 3: Summer Vacation' from the _Pricing_ table, execute the following query: ```sql SELECT SUM(Price) FROM Pricing WHERE MovieID='2056' OR MovieID='2058' ``` This will generate the following output:
SUM(Price)
20.7
### AVG() The `AVG()` function calculates and returns the average value for a numeric column's records. This can only be used for a column that contains numerical data. The `AVG()` function is used along with the `SELECT` statement for a particular column alone. The `AVG ()` ZCQL function can be applied on the following data types: - **Date** - **DateTime** - **Boolean** > **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. The basic syntax for using a `AVG()` function with the `SELECT` statement is: ```sql SELECT AVG(column_name) FROM base_table_name ``` **Example**: To view the average ticket price for the movies in the _Pricing_ table, execute the following query: ```sql SELECT AVG(Price) As AverageTicketPrice FROM Pricing ``` This will generate the following output:
AVG(Price)
9.19
### DISTINCT The `DISTINCT` statement returns only the distinct record values for a column. If there are duplicate values in a column, this statement will not return the duplicates. The `DISTINCT` statement is used along with the `SELECT` statement in a query. The basic syntax for using a `SELECT DISTINCT` statement is: ```sql SELECT DISTINCT column_name(s) FROM base_table_name ``` **Example**: To view the distinct theaters the movies are being screened at, execute the following query: ```sql SELECT DISTINCT Theaters.TheaterName FROM Movies INNER JOIN Theaters ON Movies.TheaterID=Theaters.TheaterID ``` This will generate the following output:
TheaterName
The Express Cinemas
Cosmos Theater
FunTime Cinemas
### Use Multiple ZCQL Functions You can use multiple ZCQL functions on the same column in a single ZCQL query statement. **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 4500
ZT-4289 Michelle Mascarenhas Finance 89000
Next, we apply multiple ZCQL functions together in the query, as shown below: ```sql SELECT MIN (Salary), MAX (Salary), COUNT (Salary), SUM (Salary), AVG (Salary) FROM Zylker_Employee_DB ```
MAX(Salary) SUM(Salary) MIN(Salary) AVG(Salary) COUNT(Salary)
89000 193500 4500 48975 4
> **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. -------------------------------------------------------------------------------- title: "ZCQL V2 Syntax and 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-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/syntax-exceptions/" service: "CloudScale" -------------------------------------------------------------------------------- # 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`'
-------------------------------------------------------------------------------- title: "The ZCQL Console" 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-11-03T15:16:51.000Z" source: "https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/zcql-console/" service: "CloudScale" -------------------------------------------------------------------------------- # The ZCQL Console The **ZCQL Console** is an intuitive tool that allows you to execute your required ZCQL queries, perform data manipulation operations on data stored in the [Data Store](https://docs.catalyst.zoho.com/en/cloud-scale/help/data-store/introduction/), and save your required ZCQL queries directly in the Catalyst console. ### Feature Highlights ![catalyst_zcql_console_first_view](https://catalyst-docs-development.zohostratus.in/images/help/zcql/catalyst_zcql_console_first_view.webp) The *ZCQL Console* provides you with the following offerings: * When you type in a query, you are provided with a relevant and meaningful code completion suggestion that allows you to form your queries easily and quickly. * Execute any query in the console, and you can directly view the complete output. * Copy the query using the *copy button* and apply it to your code with ease. * Save any of your required ZCQL queries and reuse it when required. * Using the **ZCQL Explorer**, you can easily search for and reuse the required saved query, view column information of all the tables created in the project, and also reuse previously executed queries from the *History* section. > **Note:** * By default, only **50 ZCQL queries** can be saved in a single Catalyst project. If you have a higher requirement, you can contact the [Catalyst Support team](mailto:support@zohocatalyst.com) to increase this threshold. * Only the latest **100 ZCQL queries** will be logged in the *History* section of the **ZCQL Explorer**. However, there is no time limit on how long the query will be available in the *History*. ### Access the ZCQL Console To access the ZCQL Console: 1. Navigate to the **Data Store** component present under the *STORAGE* section of the [CloudScale service](https://docs.catalyst.zoho.com/en/cloud-scale/). ![catalyst_zcql_console_datastore_page](https://catalyst-docs-development.zohostratus.in/images/help/zcql/catalyst_zcql_console_datastore_page.webp) > **Note:** You need to [create a table](https://docs.catalyst.zoho.com/en/cloud-scale/help/data-store/tables/#create-a-new-table) in the **Data Store** to be able to access the **ZCQL Console**. 2. Click the **ZCQL Console** tab. ![catalyst_zcql_console_view_tab_highlight](https://catalyst-docs-development.zohostratus.in/images/help/zcql/catalyst_zcql_console_view_tab_highlight.webp) You can type your query in this console and perform the required operations. ### The ZCQL Explorer The *ZCQL Explorer* is an expandable and collapsible feature of the ZCQL console. It contains the following sections: * **Schema**: Schema contains information about the table that includes the list of columns present in the table, if the value for the columns is mandatory, and the datatype of the data that will be stored in these columns. ![catalyst_zcql_console_zcql_explorer_schema](https://catalyst-docs-development.zohostratus.in/images/help/zcql/catalyst_zcql_console_zcql_explorer_schema.webp) * **Saved Queries**: This section will contain a list of all the queries you have saved using the **Save Query** button. You can search for your required query using its name and reuse it. ![catalyst_zcql_console_console_explorer_saved_queries](https://catalyst-docs-development.zohostratus.in/images/help/zcql/catalyst_zcql_console_console_explorer_saved_queries.webp) > **Note:** By default, only **50 ZCQL queries** can be saved in a single Catalyst project. If you have a higher requirement, you can contact the [Catalyst Support team](mailto:support@zohocatalyst.com) to increase this threshold. * **History**: The *History* section will contain the complete list of the **latest 100 queries** that have been executed in the console. ![catalyst_zcql_console_zcql_explorer_history_section](https://catalyst-docs-development.zohostratus.in/images/help/zcql/catalyst_zcql_console_zcql_explorer_history_section.webp) If you wish to save a query from the *History* section, click the **save-icon** next to the required query and follow the steps listed in this [section](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/zcql-console/#save-a-zcql-query). > **Note**: Only the latest **100 ZCQL queries** will be present in the *History* section. However, there is no time limit on how long the query can be stored in *History*. ### Execute a ZCQL Query To execute a ZCQL query in the ZCQL Console: 1. Enter your ZCQL query in the console. ![catalyst_zcql_console_enterquery](https://catalyst-docs-development.zohostratus.in/images/help/zcql/catalyst_zcql_console_enterquery.webp) 2. Click the **Execute Query** button. ![catalyst_zcql_query_query_executed](https://catalyst-docs-development.zohostratus.in/images/help/zcql/catalyst_zcql_query_query_executed.webp) You will be able to view the output directly in the console. The query will be executed and logged in the *History* section present in the **ZCQL Explorer**. By default, you will be viewing the output in *Table View*. You also have the option to view the output as a JSON by clicking the **View** drop-down, and selecting the **JSON View** option. ![catalyst_zcql_console_json_output_view](https://catalyst-docs-development.zohostratus.in/images/help/zcql/catalyst_zcql_console_json_output_view.webp) You also have the option to copy this JSON and use it as required. ### Save a ZCQL Query In the ZCQL Console, you can execute your required queries and save them. Saving your queries allows you to retrieve them easily and use them whenever they are required instead of manually inputting them for each session. > **Note:** By default, only **50 ZCQL queries** can be saved in a single Catalyst project. If you have a higher requirement, you can contact the [Catalyst Support team](mailto:support@zohocatalyst.com) to increase this threshold. To save a ZCQL query: 1. Enter your required query, and click the **Save Query** button. ![catalyst_zcql_console_enter_query_save_hihlit](https://catalyst-docs-development.zohostratus.in/images/help/zcql/catalyst_zcql_console_enter_query_save_hihlit.webp) 2. In the pop-up, go through the *Query Preview* section and provide a **Query Name** to refer your query by and click **Save**. ![catalyst_zcql_console_save_query_pop](https://catalyst-docs-development.zohostratus.in/images/help/zcql/catalyst_zcql_console_save_query_pop.webp) Your query will be saved. You can view and manage your queries from the *ZCQL Explorer* section, under the **Saved Queries** tab. ![catalyst_zcql_console_query_saved_show](https://catalyst-docs-development.zohostratus.in/images/help/zcql/catalyst_zcql_console_query_saved_show.webp) You can click the *Console* button to print the query into your console. ![catalyst_zcql_console_console_button_click_hihlit](https://catalyst-docs-development.zohostratus.in/images/help/zcql/catalyst_zcql_console_console_button_click_hihlit.webp) You can also further edit this query and execute it as needed or save it under a different query name by repeating the steps mentioned above. ### Delete a Saved Query To delete a saved query: 1. Click the **delete-icon** present next to the required query in the **Saved Queries** section of the *ZCQL Explorer*. ![catalyst_zcql_console_query_del_icon](https://catalyst-docs-development.zohostratus.in/images/help/zcql/catalyst_zcql_console_query_del_icon.webp) 2. Click **Yes, Proceed** on the confirmation pop-up to delete the required query. ![catalyst_zcql_console_delete_prompt](https://catalyst-docs-development.zohostratus.in/images/help/zcql/catalyst_zcql_console_delete_prompt.webp) The query will be deleted. ### Using ZCQL V2 in Function Code To use **ZCQL V2** code in your function, you will need to set an environment variable for it in the following manner: 1. Navigate to *Serverless* > **Functions**. ![catalyst_zcql_v2_func_list](https://catalyst-docs-development.zohostratus.in/images/help/zcql/catalyst_zcql_v2_func_list.webp) 2. Click the function that contains your ZCQL V2 code. 3. Click the **Configuration** tab, then click **Create Variable** under *Environmental Variables*. ![zcql_v2_create_env_variable](https://catalyst-docs-development.zohostratus.in/images/help/zcql/zcql_v2_create_env_variable.webp) 4. Enter the following values in the respective fields: **Key**: `ZOHO_CATALYST_ZCQL_PARSER` **Development Value**: `V2` ![catalyst_zcql_parser_env_setting](https://catalyst-docs-development.zohostratus.in/images/help/zcql/catalyst_zcql_parser_env_setting.webp) 5. Click **Save**. ![catalyst_zcql_env_variable_set](https://catalyst-docs-development.zohostratus.in/images/help/zcql/catalyst_zcql_env_variable_set.webp) You will now be able to use ZCQL V2 in your function code. > **Note:** * You do not have to reference the environment variable anywhere in your code. Once you have configured it in the console, you can use **ZCQL V2** in your function code. * 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. --- ## API Reference — ZCQL -------------------------------------------------------------------------------- title: "Execute ZCQL Query" description: "This API enables you to execute a ZCQL query to retrieve, insert, update, or delete data from the tables in the Data Store." last_updated: "2026-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/en/api/code-reference/cloud-scale/zcql/execute-zcql-query/" service: "CloudScale" -------------------------------------------------------------------------------- # ZCQL [ZCQL](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/introduction/) is Catalyst's own query language that enables you to perform data retrieval, insertion, updating, and deletion operations on the tables in the [Catalyst Data Store](https://docs.catalyst.zoho.com/en/cloud-scale/help/data-store/introduction/). You can execute a variety of DML queries using ZCQL to obtain or manipulate data, and use various clauses and statements such as the SQL Join clauses, Groupby and OrderBy statements, and built-in SQL functions. # Execute a ZCQL Query ### Description This API enables you to execute a ZCQL query to retrieve, insert, update, or delete data from the tables in the Data Store. You can execute this API by passing a ZCQL query in the JSON request, as shown in the sample requests. > **Note:** The API request format is the same for all ZCQL query execution operations. ### Request Details #### Request URL `POST` {api-domain}/baas/v1/project/{project_id}/query - **api-domain** (URL): The DC-specific domain to access Catalyst API - **project_id** (Numerical): The [unique ID](https://docs.catalyst.zoho.com/en/getting-started/set-up-a-catalyst-project/general-settings/) of the project #### Request Headers **Authorization:** Zoho-oauthtoken {oauth_token} **Content-Type:** application/json **Optional Headers** **CATALYST-ORG:** {org_id} **Environment:** Development #### Scope ZohoCatalyst.zcql.CREATE > **Note:** This operation can also be executed with Catalyst user authentication permissions using Catalyst SDKs. Refer to the [Catalyst API Prerequisites section](https://docs.catalyst.zoho.com/en/api/introduction/overview-and-prerequisites/#prerequisites) for details. #### Request JSON Properties - **query** (string, mandatory): The ZCQL query to be executed ### Response Details Data Retrieval Operations: The API returns the records that were fetched as a result of the query execution as the response. Data Insertion and Updating Operations: The API returns the records that were inserted or updated through the query as the response. Data Deletion Operations: The API returns the deleted row count. **Sample Request: Data Retrieval** ```bash curl -X POST \ https://api.catalyst.zoho.com/baas/v1/project/4000000006007/query \ -H "Authorization: Zoho-oauthtoken 1000.910*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*16.2f*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*57" \ -H "Content-Type: application/json" \ -d '{ "query":"SELECT EmpID, EmpName, Department, Address from EmpDetails ORDER BY EmpID ASC LIMIT 1000,5" }' ``` **Sample Response: Data Retrieval** ```json { "status": "success", "data": [ { "EmpDetails": { "CREATORID": "3376000000002003", "MODIFIEDTIME": "2023-06-05 15:09:33:881", "CREATEDTIME": "2023-06-05 15:09:33:881", "ROWID": "3376000001924975", "EmpID": "1001", "EmpName": "Allison Powell", "Department":"Marketing", "Address": "13, Winter Avenue, Philadelphia, PY" } }, { "EmpDetails": { "CREATORID": "3376000000002003", "MODIFIEDTIME": "2023-06-05 15:09:33:881", "CREATEDTIME": "2023-06-05 15:09:33:881", "ROWID": "3376000001927682", "EmpID": "1002", "EmpName": "James Cortez", "Department":"HR", "Address": "25, Blossom Street, Austin, TX" } }, { "EmpDetails": { "CREATORID": "3376000000002003", "MODIFIEDTIME": "2023-06-02 21:04:11:111", "CREATEDTIME": "2023-06-02 15:05:21:001", "ROWID": "3376000001224112", "EmpID": "1003", "EmpName": "Han Chan", "Department":"Sales", "Address": "112, St.Patrick's Road, Louisville, KY" } }, { "EmpDetails": { "CREATORID": "337600000003111", "MODIFIEDTIME": "2023-06-02 21:04:11:111", "CREATEDTIME": "2023-06-02 15:05:21:001", "ROWID": "3376000001242012", "EmpID": "1004", "EmpName": "Rubella Miguel", "Department":"Accounts", "Address": "333, Marine Bay, Salt Lake City, UT" } }, { "EmpDetails": { "CREATORID": "3376000000115254", "MODIFIEDTIME": "2023-04-12 21:04:10:521", "CREATEDTIME": "2023-06-11 15:05:02:541", "ROWID": "3376000001241341", "EmpID": "1005", "EmpName": "Ronwick Boseman", "Department":"Support", "Address": "61, Gringott's Avenue, Herfordshire, CO" } } ] } ``` **Sample Request: Data Insertion** ```bash curl -X POST \ https://api.catalyst.zoho.com/baas/v1/project/4000000006007/query \ -H "Authorization: Zoho-oauthtoken 1000.910*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*16.2f*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*57 \ -H "Content-Type: application/json" \ -d '{ "query":"INSERT INTO EmpDetails VALUES (1007,'Randy Marsh','Sales','42, Tenth Street, Jacksonville, FL', '14 MAR 2017')" }' ``` **Sample Response: Data Insertion** ```json { "status": "success", "data": [ { "EmpDetails": { "CREATORID": "3813000000002003", "EmpID": "1007", "EmpName": "Randy Marsh", "Department":"Sales", "Address": "42, Tenth Street, Jacksonville, FL", "DOJ": "14 MAR 2017", "MODIFIEDTIME": "2021-08-04 09:10:14:752", "CREATEDTIME": "2021-08-04 09:10:14:752", "ROWID": "3813000000214001" } } ] } ``` **Sample Request: Data Updating** ```bash curl -X POST \ https://api.catalyst.zoho.com/baas/v1/project/4000000006007/query \ -H "Authorization: Zoho-oauthtoken 1000.910*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*16.2f*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*57 \ -H "Content-Type: application/json" \ -d '{ "query":"UPDATE EmpDetails SET Department='Operations' WHERE EmpID=1007" }' ``` **Sample Response: Data Updating** ```json { "status": "success", "data": [ { "EmpDetails": { "CREATORID": "3813000000002003", "EmpID": "1007", "EmpName": "Randy Marsh", "Department":"Operations", "Address": "42, Tenth Street, Jacksonville, FL", "DOJ": "14 MAR 2017", "MODIFIEDTIME": "2021-08-04 09:11:54:318", "CREATEDTIME": "2021-08-04 09:10:14:752", "ROWID": "3813000000214001" } } ] } ``` **Sample Request: Data Deletion** ```bash curl -X POST \ https://api.catalyst.zoho.com/baas/v1/project/4000000006007/query \ -H "Authorization: Zoho-oauthtoken 1000.910*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*16.2f*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*57 \ -H "Content-Type: application/json" \ -d '{ "query":"DELETE FROM EmpDetails WHERE EmpID=1007" }' ``` **Sample Response: Data Deletion** ```json { "status": "success", "data": [ { "EmpDetails": { "DELETED_ROWS_COUNT": 1 } } ] } ``` ### SDK Documentation [Execute ZCQL Query- Java SDK](https://docs.catalyst.zoho.com/en/sdk/java/v1/cloud-scale/zcql/execute-zcql-query)

[Execute ZCQL Query- Node.js SDK](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/zcql/execute-zcql-query)

[Execute ZCQL Query- Python SDK](https://docs.catalyst.zoho.com/en/sdk/python/v1/cloud-scale/zcql/execute-zcql-query)

[Execute ZCQL Query- Web SDK](https://docs.catalyst.zoho.com/en/sdk/web/v4/cloud-scale/zcql/execute-zcql-query) --- ## SDK — Android — ZCQL -------------------------------------------------------------------------------- title: "Execute ZCQL Query" description: "ZCQL is Catalyst's own query language that enables you to perform data creation, retrieval, and modification operations in the Data Store." last_updated: "2026-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/en/sdk/android/v2/cloud-scale/zcql/execute-zcql-query/" service: "CloudScale" related: - Data Store (/en/cloud-scale/help/data-store/introduction) - ZCQL (/en/cloud-scale/help/zcql/introduction/) - Execute ZCQL - API (/en/api/code-reference/cloud-scale/zcql/execute-zcql-query/#ExecuteZCQLQuery) -------------------------------------------------------------------------------- # ZCQL ZCQL is Catalyst's own query language that enables you to perform data creation, retrieval, and modification operations in the [Data Store](https://docs.catalyst.zoho.com/en/cloud-scale/help/data-store/introduction). It supports queries with built-in functions, SQL Join clauses, and other statements and conditions. ### Execute a ZCQL Query Before you execute a ZCQL query to fetch the required data set, you must construct the query to pass it to the `execute()` method. You can learn about the ZCQL syntax from the [ZCQL help page](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/introduction). You must pass an instance of `ZCatalystSelectQuery` to the `execute()` method, as shown in the code syntax of a ZCQL query execution below. The `<DATA_STORE_INSTANCE>` used here is the instance defined in the [Data Store Instance page](https://docs.catalyst.zoho.com/en/sdk/android/v2/cloud-scale/data-store/create-data-store-instance). ```bash ZCatalystApp.getInstance().getDataStoreInstance().execute( selectQuery: ZCatalystSelectQuery, success: (List<Map<String, Map<String, Any?>>>) → Unit, failure: ((ZCatalystException) → Unit)? ): ZCatalystRequest<ZCatalystResponse<List<Map<String, Any?>>>>>? ``` **Parameters**: * `selectQuery`: The instance of the type `ZCatalystSelectQuery` to be passed You can create a `selectQuery` instance for `ZCatalystSelectQuery` for the statements supported by ZCQL, in the following way: ```bash ZCatalystSelectQuery.Builder() .select(columns: Set<Column>): ZCatalystSelectQuery.Builder .selectAll(): ZCatalystSelectQuery.Builder .where(column: String, comparator: ZCatalystUtil.Comparator, value: String): ZCatalystSelectQuery.Builder .from(tableName: String): ZCatalystSelectQuery.Builder .and(column: String, comparator: ZCatalystUtil.Comparator, value: String): ZCatalystSelectQuery.Builder .groupBy(columns: Set<Column>): ZCatalystSelectQuery.Builder .orderBy(columns: Set<Column>, sortOrder: ZCatalystUtil.SortOrder): ZCatalystSelectQuery.Builder .innerJoin(tableName: String): ZCatalystSelectQuery.Builder .leftJoin(tableName: String): ZCatalystSelectQuery.Builder .on(joinColumn1: String, comparator: ZCatalystUtil.Comparator, joinColumn2: String): ZCatalystSelectQuery.Builder .or(column: String, comparator: ZCatalystUtil.Comparator, value: String): ZCatalystSelectQuery.Builder .limit(offset: Int, value: Int?): ZCatalystSelectQuery.Builder .build(): ZCatalystSelectQuery ``` A sample code snippet of a ZCQL query execution is shown below: ```bash val query = ZCatalystSelectQuery.Builder() .selectAll() .from("EmployeeDetails") //Replace this with your table name .where("Location", ZCatalystUtil.Comparator.EQUAL_TO, "Austin") .and("Department", ZCatalystUtil.Comparator.EQUAL_TO, "Marketing") .or("isActive", ZCatalystUtil.Comparator.EQUAL_TO, "true") .limit(5) .build() ZCatalystApp.getInstance().getDataStoreInstance().execute(query, { println("Query executed successfully. $it") }, { exception -> println("Exception occured $exception") }) ``` --- ## SDK — Flutter — ZCQL -------------------------------------------------------------------------------- title: "Execute ZCQL Query" description: "ZCQL is Catalyst's own query language that enables you to perform data creation, retrieval, and modification operations in the Data Store." last_updated: "2026-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/en/sdk/flutter/v2/cloud-scale/zcql/execute-zcql-query/" service: "CloudScale" related: - Data Store (/en/cloud-scale/help/data-store/introduction) - ZCQL (/en/cloud-scale/help/zcql/introduction/) - Execute ZCQL - API (/en/api/code-reference/cloud-scale/zcql/execute-zcql-query/#ExecuteZCQLQuery) -------------------------------------------------------------------------------- # ZCQL ZCQL is Catalyst's own query language that enables you to perform data creation, retrieval, and modification operations in the [Data Store](https://docs.catalyst.zoho.com/en/cloud-scale/help/data-store/introduction). It supports queries with built-in functions, SQL Join clauses, and other statements and conditions. ### Execute a ZCQL Query Flutter enables you to perform data retrieval operations using ZCQL. Before you execute a ZCQL query to fetch the required data set, you must construct the query to pass it to the `getData()` method. You can learn about the ZCQL syntax from the [ZCQL help page](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/introduction). You must pass an instance of `ZCatalystSelectQuery` to the `getData()` method, as shown in the code syntax of a ZCQL query execution below. The `<DATA_STORE_INSTANCE>` used here is the instance defined in the [Data Store Instance page](https://docs.catalyst.zoho.com/en/sdk/flutter/v2/cloud-scale/data-store/create-data-store-instance). ```bash Future<(APIResponse, List<dynamic>?)> ZCatalystApp.getInstance().getDataStoreInstance().getData( ZCatalystSelectQuery selectQuery) ``` **Parameters**: * `selectQuery`: The instance of the type `ZCatalystSelectQuery` to be passed You can create a `selectQuery` instance for `ZCatalystSelectQuery` for the statements supported by ZCQL, in the following way: ```bash ZCatalystSelectQuery.Builder() .select(columns: Set<Column>): ZCatalystSelectQuery.Builder .selectAll(): ZCatalystSelectQuery.Builder .where(column: String, comparator: ZCatalystUtil.Comparator, value: String): ZCatalystSelectQuery.Builder .from(tableName: String): ZCatalystSelectQuery.Builder .and(column: String, comparator: ZCatalystUtil.Comparator, value: String): ZCatalystSelectQuery.Builder .groupBy(columns: Set<Column>): ZCatalystSelectQuery.Builder .orderBy(columns: Set<Column>, sortOrder: ZCatalystUtil.SortOrder): ZCatalystSelectQuery.Builder .innerJoin(tableName: String): ZCatalystSelectQuery.Builder .leftJoin(tableName: String): ZCatalystSelectQuery.Builder .on(joinColumn1: String, comparator: ZCatalystUtil.Comparator, joinColumn2: String): ZCatalystSelectQuery.Builder .or(column: String, comparator: ZCatalystUtil.Comparator, value:String): ZCatalystSelectQuery.Builder .limit(offset: Int, value: Int?): ZCatalystSelectQuery.Builder .build(): ZCatalystSelectQuery ``` A sample code snippet of a ZCQL query execution is shown below: ```bash try { ZCQLColumn column1 = ZCQLColumn('Title'); ZCQLColumn column2 = ZCQLColumn('Category'); Set<ZCQLColumn> columns = Set(); columns.add(column1); columns.add(column2); ZCatalystSelectQuery query = ZCatalystQueryBuilder() .select(columns) .from('Projects') .where('Category', Comparator.EQUAL_TO, 'Official') .build(); var (_, result) = await app.getDataStoreInstance().getData(query); print("Query Result: $result"); } on ZCatalystException catch (ex) { print(ex.toString()); } ``` --- ## SDK — iOS — ZCQL -------------------------------------------------------------------------------- title: "Execute ZCQL Query" description: "ZCQL is Catalyst's own query language that enables you to perform data creation, retrieval, and modification operations in the Data Store." last_updated: "2026-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/en/sdk/ios/v2/cloud-scale/zcql/execute-zcql-query/" service: "CloudScale" related: - Data Store (/en/cloud-scale/help/data-store/introduction) - ZCQL (/en/cloud-scale/help/zcql/introduction/) - Execute ZCQL - API (/en/api/code-reference/cloud-scale/zcql/execute-zcql-query/#ExecuteZCQLQuery) -------------------------------------------------------------------------------- # ZCQL ZCQL is Catalyst's own query language that enables you to perform data retrieval operations in the [Data Store](https://docs.catalyst.zoho.com/en/cloud-scale/help/data-store/introduction). It supports SELECT queries with built-in functions, SQL Join clauses, and other statements and conditions. ### Execute a ZCQL Query Before you execute a ZCQL query to fetch the required data set, you must construct the query to pass it to the `execute()` method. You can learn about the ZCQL syntax from the [ZCQL help page](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/introduction). You must pass an instance of `ZCatalystSelectQuery` to the `execute()` method, as shown in the code syntax of a ZCQL query execution below. ```bash <ZCatalystApp>.execute( query : ZCatalystSelectQuery, completion: @escaping (Result<[ [ String : Any ] ], ZCatalystError>) -> Void) ``` **Parameters**: * `query`: The instance of the type `ZCatalystSelectQuery` to be passed * `completion`: If the query execution call is successful, the completion block will return with the records that match the criteria of the query. Else, it will return an error. You can create a `query` instance for the ZCatalystSelectQuery for the statements supported by ZCQL, in the following way: ```bash ZCatalystSelectQuery.Builder() .select(columns: Set<Column>) -> ZCatalystSelectQuery.Builder .selectAll() -> ZCatalystSelectQuery.Builder .where(column: String, comparator: Comparator, value: String) -> ZCatalystSelectQuery.Builder .from(tableName: String) -> ZCatalystSelectQuery.Builder .and(column: String, comparator: Comparator, value: String) -> ZCatalystSelectQuery.Builder .groupBy(columns: Set<Column>) -> ZCatalystSelectQuery.Builder .orderBy(columns: Set<Column>, sortOrder: SortOrder) -> ZCatalystSelectQuery.Builder .innerJoin(tableName: String) -> ZCatalystSelectQuery.Builder .leftJoin(tableName: String) -> ZCatalystSelectQuery.Builder .on(joinColumn1: String, comparator: Comparator, joinColumn2: String) -> ZCatalystSelectQuery.Builder .or(column: String, comparator: Comparator, value: String) -> ZCatalystSelectQuery.Builder .limit(offset: Int, value: Int? = nil) -> ZCatalystSelectQuery.Builder .build() -> ZCatalystSelectQuery ``` A sample code snippet of a ZCQL query execution is shown below: ```bash func testExecuteZCQL(){ var builder = ZCatalystSelectQuery.Builder() var query = builder.selectAll().from( tableName : "Bio-data" ).build() //replace your table name here ZCatalystApp.shared.getDataStoreInstance(tableIdentifier: "1096000000002071").execute( query : query) { ( result ) in switch result{ case .success( let response ) : print("Response : \( response )") case .error( let error ) : print( "Error occurred >>> \( error )" ) } } } ``` --- ## SDK — Java — ZCQL -------------------------------------------------------------------------------- title: "Execute ZCQL queries" description: "This page describes the method to execute ZCQL queries on a table in the Data Store in your Java application with sample code snippets." last_updated: "2026-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/en/sdk/java/v1/cloud-scale/zcql/execute-zcql-query/" service: "CloudScale" related: - Execute ZCQL queries - API (/en/api/code-reference/cloud-scale/zcql/execute-zcql-query/#ExecuteZCQLQuery) - Execute ZCQL queries (/en/cloud-scale/help/zcql/introduction) - Data Store (/en/cloud-scale/help/data-store/introduction) -------------------------------------------------------------------------------- # ZCQL [ZCQL](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/introduction) is Catalyst's own query language that enables you to perform data retrieval, insertion, updating, and deletion operations on the tables in the [Catalyst Data Store](https://docs.catalyst.zoho.com/en/cloud-scale/help/data-store/introduction). You can execute a variety of DML queries using ZCQL to obtain or manipulate data, and use various clauses and statements such as the SQL Join clauses, Groupby and OrderBy statements, and built-in SQL functions. ### Execute ZCQL Queries Catalyst also provides an [**OLAP database**](https://docs.catalyst.zoho.com/en/cloud-scale/help/data-store/olap-database/introduction/), in addition to the primary Data Store that is suited for analytical data retrieval queries. You can choose to execute simple transactional queries on the primary Data Store, and complex analytical queries that involve [ZCQL functions](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/zcql-functions/) on the OLAP database. The queries that you execute on the primary Data Store can include SELECT, INSERT, UPDATE, or DELETE statements. The queries that you execute on the OLAP database must only include the SELECT statement, as direct write operations on it are not allowed. You must construct a ZCQL query and pass it to the `executeQuery()` method for execution as shown in the sample code below. The `executeQuery()` method supports these three parameters: * The String variable containing the constructed query statement * `isV2?`: A boolean value (`true` or `false`) indicating if it is a ZCQL v2 query * `isOLAP?`: A boolean value (`true` or `false`) indicating if the query needs to be executed on the OLAP database ```sql executeQuery(query: string, isV2?: boolean , isOLAP?:boolean) ``` A sample SELECT query is shown below. The response will contain the records you fetch using the SELECT query, or the response generated for the other operations. #### Sample Code Snippet **Package Imports** ```java import com.zc.component.object.ZCRowObject; import com.zc.component.zcql.ZCQL; ``` ```java //Construct the query to be executed String query = "SELECT * from empDetails limit 10"; //Get the ZCQL instance and execute query using the query string ArrayList rowList = ZCQL.getInstance().executeQuery(query, true , false) ``` --- ## SDK — Python — ZCQL -------------------------------------------------------------------------------- title: "Get ZCQL Instance" description: "This page describes the method to execute ZCQL queries on a table in the Data Store in your Python application with sample code snippets." last_updated: "2026-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/en/sdk/python/v1/cloud-scale/zcql/get-component-instance/" service: "CloudScale" related: - ZCQL Help (/en/cloud-scale/help/zcql/introduction) - Data Store Help (/en/cloud-scale/help/data-store/introduction) -------------------------------------------------------------------------------- # ZCQL [Catalyst CloudScale ZCQL](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/introduction) is Catalyst's own query language that enables you to perform data retrieval, insertion, updation, and deletion operations on the tables in the Catalyst CloudScale Data Store. You can execute a variety of DML queries using ZCQL to obtain or manipulate data, and use various clauses and statements such as the SQL Join clauses, Groupby and OrderBy statements, and built-in SQL functions. Catalyst also provides an [**OLAP database**](https://docs.catalyst.zoho.com/en/cloud-scale/help/data-store/olap-database/introduction/), in addition to the primary Data Store that is suited for analytical data retrieval queries. You can choose to execute simple transactional queries on the primary Data Store, and complex analytical queries that involve [ZCQL functions](https://docs.catalyst.zoho.com/en/cloud-scale/help/zcql/zcql-functions/) on the OLAP database. ### Get a Component Instance A component instance is an object that can be used to access the predefined configurations specific to a particular component. This process will not fire a server-side call. The `app` reference used in the code below is the Python object returned as a response during SDK initialization. Also note that this instance will be used in multiple scenarios while performing retrieval, insertion, updating, or deleting operations in the Catalyst Data Store. ```python #Get a ZCQL component instance zcql_service = app.zcql() ``` -------------------------------------------------------------------------------- title: "Execute Query" description: "This page describes the method to execute ZCQL queries on a table in the Data Store in your Python application with sample code snippets." last_updated: "2026-11-03T07:48:52.000Z" source: "https://docs.catalyst.zoho.com/en/sdk/python/v1/cloud-scale/zcql/execute-zcql-query/" service: "CloudScale" related: - Execute query - API (/en/api/code-reference/cloud-scale/zcql/execute-zcql-query/#ExecuteZCQLQuery) - ZCQL Help (/en/cloud-scale/help/zcql/introduction) - Data Store Help (/en/cloud-scale/help/data-store/introduction) - SDK Scopes (/en/sdk/python/v1/sdk-scopes) -------------------------------------------------------------------------------- # Execute Query The `zcql_service` reference used in the code snippet below is the component instance created [earlier](https://docs.catalyst.zoho.com/en/sdk/python/v1/cloud-scale/zcql/get-component-instance/). Based on the query object being passed, the response returns a row object or an array of row objects. ### Construct and Execute the Query on the Primary Data Store For the ZCQL queries to be executed on the primary Data Store, you can construct the query object and pass it to the `execute_query()` method as shown below. These queries can include SELECT, INSERT, UPDATE, or DELETE statements. A sample INSERT query is shown below: ```javascript #Construct the ZCQL query query = 'INSERT into ShipmentData (productID, productName, region) VALUES (3782, A4 Reams, India)' result = zcql_service.execute_query(query) ``` ### Construct and Execute the Query on the OLAP Database The queries that you execute on the OLAP database must only include the SELECT statement, as direct write operations on it are not allowed. You can construct the query object and pass it to the `execute_olap_query()` method. A sample analytical SELECT query is shown below. ```javascript //Construct the query to execute query = 'SELECT SUM(price) FROM ShipmentData'; result = zcql_service.execute_olap_query(query); ``` **Parameters Used**
Parameter Name Data Type Definition
`query` String A **Mandatory** parameter. Will store the query to be executed.
> **Info :** Refer to the [SDK Scopes table](https://docs.catalyst.zoho.com/en/sdk/python/v1/sdk-scopes) to determine the required permission level for performing the above operation.