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:

    
copy
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:

    
copy
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.

Last Updated 2023-08-28 18:12:09 +0530 +0530