UPSERT Clause
UPSERT
Clause is implemented only for Google BigQuery
An UPSERT
(UPDATE
or INSERT
) statement is an SQL statement that updates an existing record in the database or adds a new record if the record does not already exist. It combines two commands: the UPDATE
command to update existing records and the INSERT
command to add new records. This statement eliminates the need to check for the existence of a record before performing an update or insert operation.
Usage
UPSERT INTO table_name(column1, column2, ...) VALUES('value1', 'value2', ...);
When working with Google BigQuery, the UPSERT
statement is pushed down as a MERGE
statement. For more information, please check the Google BigQuery documentation.
UPSERT
statement available since v4.9