
Answer-first summary for fast verification
Answer: MERGE
The MERGE command (also known as UPSERT) is specifically designed to write data into a Delta table while avoiding duplicate records. It performs the following operations: 1. **WHEN MATCHED**: Updates existing records when a match is found 2. **WHEN NOT MATCHED**: Inserts new records when no match is found This allows you to: - Update existing records with new values - Insert new records that don't already exist - Skip or handle duplicates based on specified conditions Other options: - **DROP**: Deletes a table entirely - **INSERT**: Simply inserts data without checking for duplicates - **APPEND**: Appends data to a table without checking for duplicates The MERGE command is essential for maintaining data integrity and preventing duplicate records in Delta tables.
Author: Keng Suppaseth
Ultimate access to all questions.
No comments yet.