Merge data in tables
You can conditionally insert, update, or delete existing data in Hive tables using the ACID MERGE statement.
You can conditionally insert, update, or delete existing data in Hive tables using the ACID MERGE statement.
MERGE INTO customer USING (SELECT * FROM new_customer_stage) sub ON sub.id = customer.id
WHEN MATCHED THEN UPDATE SET name = sub.name, state = sub.new_state
WHEN NOT MATCHED THEN INSERT VALUES (sub.id, sub.name, sub.state);