The BigQuery Data Manipulation Language (DML) enables you to update, insert, and delete data from your BigQuery tables.
You can execute DML statements just as you would a SELECT statement, with the following conditions:
- You must use standard SQL. To enable standard SQL, see Enabling Standard SQL.
- You cannot specify a destination table. For example, in the web UI you must have Destination Table set to No table selected.
- Each DML statement initiates an implicit transaction, which means that changes made by the statement are automatically committed at the end of each successful DML statement. There is no support for multi-statement transactions.
Only the following combinations of DML statements are allowed to run concurrently on a table:
Otherwise, one of the DML statements will be aborted. For example, if two
UPDATEstatements execute simultaneously against the table then only one of them will succeed.
Rows that were written to a table recently via streaming (using the
tabledata.insertallmethod) cannot be modified using
MERGEstatements. Recent writes are typically those that occur within the last 30 minutes. Note that all other rows in the table remain modifiable by using
- Correlated subqueries within a
merge_insert_clauseare not supported for
If there are only
INSERTclauses (there can be more than one), the
MERGEstatement behaves like an
MERGEstatement can run concurrently with other DML statements (
MERGEstatement is not limited to
INSERTclauses (it has one or more
DELETEclauses), the statement cannot run concurrently with other
DELETEclauses. The statement also cannot run concurrently with any other
Queries that contain Data Manipulation Language (DML) statements cannot use a wildcard table as the target of the query. For example, a wildcard table may be used in the
FROMclause of an
UPDATEquery, but a wildcard table cannot be used as the target of the
For information on DML pricing, see Data Manipulation Language pricing on the Pricing page.
- See DML syntax and samples on the DML syntax page.