INSERT statement adds rows to an existing dataset. NQL supports two forms: INSERT ... VALUES (...) for literal rows, and INSERT ... SELECT ... for inserting the result of a query.
INSERT runs against datasets you own. To create a new dataset from a query, use CREATE MATERIALIZED VIEW. To upsert into an existing materialized view during refresh, use the MERGE ON clause.
Syntax
VALUES form
SELECT form
Explicit column list is required
The column list afterINSERT INTO table_reference is required. NQL does not infer columns from the dataset schema, and wildcards (SELECT *) are not supported in the SELECT form either.
Column matching and types
- The number of expressions in each
VALUESrow (or columns in theSELECTclause) must match the column list. - Expressions are matched to columns by position, not by name.
- Each expression must be assignable to the target column’s data type. Implicit coercions follow the same rules as comparisons elsewhere in NQL.
Examples
Single-row VALUES:Execution context
INSERT statements can run in two places:| Execution surface | When to use |
|---|---|
| NQL query endpoint | Ad-hoc inserts from an API client or Data Studio |
ExecuteDml workflow task | Scheduled or event-driven inserts inside a workflow |
CREATE MATERIALIZED VIEW to create datasets from a query, then INSERT to add rows afterward.
Related content
UPDATE
Modify existing rows in a dataset
DELETE
Remove rows from a dataset
Incremental Upserts with MERGE ON
Update or insert rows during materialized view refresh
CREATE MATERIALIZED VIEW
Create a new dataset from a query
ExecuteDml workflow task
Run DML statements from a workflow
Data Types
Type rules for INSERT expressions

