QuestionQ57

VerifiedExecuting queries using Databricks SQL and Databricks SQL Warehouses

An analyst must combine data from two tables: suppliers and new_suppliers. Some supplier_id values may exist in both tables, indicating that those suppliers have already been added to the suppliers table. In that situation, the existing data must remain unchanged.

Which command combines the two tables without duplicating rows that have the same supplier_id?

Explanation

MERGE INTO matches rows between the target and source using supplier_id. A WHEN NOT MATCHED THEN INSERT clause inserts only source rows with no matching target row, so existing supplier rows are neither duplicated nor changed.

Learn more

Community Discussion

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