Sign in to run and submit your work
Reading is open to everyone. Running code and saving drafts need an account so your work is yours and comes back on your next visit.
or
CODE WORKSPACE
Return exactly customer_id, email, tier, is_deleted, and load_action for staged rows whose action is not unchanged.
Result columns · in this order
customer_idemailtieris_deletedload_actionHow to approach it
Reuse the action-plan CTE, then filter load_action != 'unchanged'.
Sample input
| customer_id | stage_tier | target_tier | is_deleted |
|---|---|---|---|
| 101 | gold | silver | 0 |
| 102 | silver | null | 0 |
| 103 | bronze | bronze | 1 |
| 104 | platinum | gold | 0 |
| 105 | bronze | bronze | 0 |
| 106 | silver | null | 0 |
6 rows — all rows shown.
Expected output
| customer_id | tier | is_deleted | load_action | |
|---|---|---|---|---|
| 101 | ana@example.com | gold | 0 | update |
| 102 | ben@example.com | silver | 0 | insert |
| 103 | cy@example.com | bronze | 1 | delete_candidate |
| 104 | dee@example.com | platinum | 0 | update |
| 106 | fay@example.com | silver | 0 | insert |
5 rows — all rows shown.
Constraints
Dedupe the staged source first. Compare against dim_customer_current. Include insert, update, and delete_candidate rows. Exclude unchanged customer 105. Order by customer_id.
Expected skills
Clean merge-source construction and exclusion of no-op rows.
Submit for review to find out what your query gets right, what it gets wrong, and how it compares with the best working query for this exercise.
This scenario runs a full workspace — editor, canvas and results side by side. It needs a laptop or desktop to be usable. Open this page on a bigger screen to start building.