Updated rows must replace existing ones in a Delta table. Which operation fits?
Why D is the answer
MERGE
MERGE inserts new rows and updates matches. Append would create duplicates.
In detail
- MERGE updates matching rows and inserts new ones.
- Match on a stable business key.
Use case
An illustrative scenario, not a real incident.
A customer changes address. MERGE updates the existing row and inserts new customers, so one load handles both cases.
See it in different ways
flowchart LR A["Read the last watermark"] --> B["Select newer rows"] B --> C["Merge into the target"] C --> D["Save the new watermark"]
sequenceDiagram participant P as Pipeline participant S as Source participant T as Delta table P->>P: Reads the last watermark P->>S: Rows newer than the watermark S-->>P: Changed rows P->>T: MERGE P->>P: Saves the new watermark
flowchart TD
Q{"Does the key already exist?"}
Q -->|"Yes"| A0["Update the row"]
Q -->|"No"| A1["Insert the row"]Key point: MERGE updates matches and inserts new rows.
Why the other options are wrong
- A. APPEND
- APPEND only adds rows, which creates duplicates.
- B. VACUUM
- VACUUM removes old files.
- C. DESCRIBE
- DESCRIBE shows metadata.

