DATABRICKS-CERTIFIED-DATA-ENGINEER-ASSOCIATE · Question #78
In which of the following scenarios should a data engineer use the MERGE INTO command instead of the INSERT INTO command?
The correct answer is D. When the target table cannot contain duplicate records. MERGE INTO (also called upsert) checks each incoming source row against existing rows in the target table based on a match condition. If a match is found, it can UPDATE the existing row; if no match is found, it INSERTs a new row. This prevents duplicates. INSERT INTO blindly…
Question
Options
- AWhen the location of the data needs to be changed
- BWhen the target table is an external table
- CWhen the source table can be deleted
- DWhen the target table cannot contain duplicate records
- EWhen the source is not a Delta table
How the community answered
(26 responses)- D96% (25)
- E4% (1)
Explanation
MERGE INTO (also called upsert) checks each incoming source row against existing rows in the target table based on a match condition. If a match is found, it can UPDATE the existing row; if no match is found, it INSERTs a new row. This prevents duplicates. INSERT INTO blindly appends all rows without checking for pre-existing records. When data integrity requires uniqueness (no duplicate records), MERGE INTO is the correct choice. The other options - table location, external vs. internal, deletability of source, or source format - are not determining factors for choosing MERGE INTO.
Topics
Community Discussion
No community discussion yet for this question.