Skip to main content

MERGE

Run insert or update operations on a target table from the results of a join with a source table.

Merge syntax
MERGE INTO <table_name>.<table_name> [AS target_alias]
USING
(select_statement) | <table_name>.<table_name> [AS source_alias]
ON ( condition )
WHEN MATCHED THEN
UPDATE SET <column1_name> = <value1> [, <column2_name> = <value2> ... ]
WHEN NOT MATCHED THEN
INSERT [ (<column_name> [, ...]) ]
VALUES (expression [, ...])

Parameters

{{< sql-section file="data/sql/apache-iceberg-tables.json" data="merging" >}}