Skip to content
SQLSimplified
Data EngineerQuestion 53 of 55

The MERGE Statement

Problem

In enterprise data warehouses, instead of using custom UPSERT dialects, you use a standardized SQL MERGE statement to reconcile datasets. Write a query that outputs syntax with the value: "MERGE INTO target USING source ON join_condition WHEN MATCHED THEN UPDATE WHEN NOT MATCHED THEN INSERT."

Database Schema

This problem acts as a scratchpad. You will write your own DDL/DML or conceptual queries, so there is no predefined schema.

Try It

Loading playground environment...

Hint

Solution