
Answer-first summary for fast verification
Answer: MERGE
## Explanation **Correct Answer: C (MERGE)** The MERGE command (also known as UPSERT) is specifically designed to write data into Delta tables while handling duplicates. It allows you to: 1. **Insert** new records that don't exist in the target table 2. **Update** existing records that match 3. **Delete** records based on conditions This makes MERGE ideal for avoiding duplicate records because you can specify conditions to check for existing records before inserting. **Why other options are incorrect:** - **A (DROP)**: Used to remove a table or database entirely, not for writing data while avoiding duplicates. - **B (IGNORE)**: Used to skip errors while executing queries, not for duplicate prevention during data writes. - **D (APPEND)**: Simply adds new records to the end of a table without checking for duplicates. - **E (INSERT)**: Adds new records but will fail if there are primary key violations or create duplicates if no constraints exist. **Key Concept:** In Databricks Delta Lake, MERGE operations are atomic and provide ACID transactions, making them the recommended approach for upsert operations where you need to avoid writing duplicate records while maintaining data integrity.
Author: Keng Suppaseth
Ultimate access to all questions.
No comments yet.