QuestionQ149

VerifiedDeveloping Code for Data Processing using Python and SQL

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

Question Image

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

When this query runs, what happens to new records that have the same event_id as an existing record?

Explanation

WHEN NOT MATCHED THEN INSERT * inserts only source rows whose event_id does not match a row in the target table. Records with an existing matching event_id have no WHEN MATCHED update or other action, so they are left unchanged and the source records are ignored.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!