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 event_id, user_id, and sku for checkout payload items.
Result columns · in this order
event_iduser_idskuHow to approach it
Join events to json_each(payload, '$.items').
Sample input
| event_id | user_id | event_name | payload |
|---|---|---|---|
| 2 | 1 | checkout | {"device":"ios","items":["SKU-A","SKU-B"]} |
| 4 | 2 | checkout | {"device":"web","items":["SKU-C"]} |
2 rows — all rows shown.
Expected output
| event_id | user_id | sku |
|---|---|---|
| 2 | 1 | SKU-A |
| 2 | 1 | SKU-B |
| 4 | 2 | SKU-C |
3 rows — all rows shown.
Constraints
Use json_each on $.items and keep only checkout events.
Expected skills
Array expansion and event-item grain.
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.