Exam Certified Data Engineer Professional All QuestionsBrowse all questions from this exam
Question 27

A junior data engineer on your team has implemented the following code block.

The view new_events contains a batch of records with the same schema as the events Delta table. The event_id field serves as a unique key for this table.

When this query is executed, what will happen with new records that have the same event_id as an existing record?

    Correct Answer: B

    The code snippet uses the MERGE statement to combine data from the 'new_events' view into the 'events' table based on the 'event_id' field. The 'WHEN NOT MATCHED' clause specifies that new records (those that do not have a matching 'event_id' in the 'events' table) should be inserted. There is no clause that defines what happens when existing records with the same 'event_id' are matched. Therefore, according to the standard behavior of the MERGE statement without a 'WHEN MATCHED' clause, existing records with matching 'event_id' will be ignored and left unchanged.

Discussion
rairaixOption: B

The answer is correct. "If none of the WHEN MATCHED conditions evaluate to true for a source and target row pair that matches the merge_condition, then the target row is left unchanged." https://docs.databricks.com/en/sql/language-manual/delta-merge-into.html#:~:text=If%20none%20of%20the%20WHEN%20MATCHED%20conditions%20evaluate%20to%20true%20for%20a%20source%20and%20target%20row%20pair%20that%20matches%20the%20merge_condition%2C%20then%20the%20target%20row%20is%20left%20unchanged.

PrashantTiwariOption: B

B is correct

imatheushenriqueOption: B

B. They are ignored. Because there is not mention so there is no WHEN statement for this condition

kz_dataOption: B

B is correct

alexvnoOption: B

Ignored