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 clean_status and orders after mapping paid/shipped to complete_or_paid and pending to open.
Result columns · in this order
clean_statusordersHow to approach it
Create cleaned_orders first, then group by clean_status.
Sample input
| order_id | status |
|---|---|
| 1001 | paid |
| 1004 | shipped |
| 1003 | pending |
| 1006 | refunded |
| 1010 | paid |
5 rows — all rows shown.
Expected output
| clean_status | orders |
|---|---|
| complete_or_paid | 9 |
| open | 2 |
| refunded | 1 |
3 rows — all rows shown.
Constraints
Use a cleanup CTE, CASE, COUNT(*), and deterministic ordering.
Expected skills
Cleanup CTEs, CASE branches, and grouped counts.
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.