
Ultimate access to all questions.
Which of the following commands can be used to write data into a Delta table while avoiding the writing of duplicate records?
A
DROP
B
IGNORE
C
MERGE
Explanation:
The correct answer is MERGE.
WHEN MATCHED THEN UPDATE and WHEN NOT MATCHED THEN INSERTignoreDuplicates in some APIs, it's not a SQL commandMERGE INTO target_table AS target
USING source_table AS source
ON target.id = source.id
WHEN MATCHED THEN UPDATE SET *
WHEN NOT MATCHED THEN INSERT *;
MERGE INTO target_table AS target
USING source_table AS source
ON target.id = source.id
WHEN MATCHED THEN UPDATE SET *
WHEN NOT MATCHED THEN INSERT *;
This pattern ensures that existing records are updated and new records are inserted, preventing duplicates based on the matching condition.