Skip to main content
The UPDATE statement modifies existing rows in a dataset. Each UPDATE assigns new values to one or more columns, optionally filtered by a WHERE clause.
UPDATE runs against datasets you own. To update rows during a materialized view refresh, use the MERGE ON clause inside CREATE MATERIALIZED VIEW instead.

Syntax

  • The SET clause lists column assignments. The right-hand side of each assignment can be any NQL expression valid for the target column’s data type, including references to other columns in the same row.
  • The WHERE clause is optional. If omitted, every row in the dataset is updated — include a WHERE clause unless that is the intended behavior.
  • The SET expressions and the WHERE condition can reference only the target dataset. Subqueries that read from another dataset (for example, WHERE id IN (SELECT id FROM company_data."456")) are not supported.

Examples

Update a single column with a literal:
Update multiple columns using an expression:
Conditional update across many rows:

Execution context

UPDATE statements can run in two places:
Running UPDATE without a WHERE clause modifies every row in the target dataset. Review the statement — or run the corresponding SELECT with the same predicate first — before executing.

INSERT

Add rows to a dataset

DELETE

Remove rows from a dataset

Incremental Upserts with MERGE ON

Update or insert rows during materialized view refresh

ExecuteDml workflow task

Run DML statements from a workflow