Your question is Compute Delta Between Events. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
The monday Work Management team wants to monitor how long items remain open on a board. Given separate creation and completion event tables, write a PostgreSQL query that calculates the elapsed time between the two timestamped events for every created item.
item_created_events, including items without a completion event.item_completed_events using item_id.delta_hours, rounded to two decimal places. Return NULL when the completion timestamp is unavailable.| Column | Type | Description |
|---|---|---|
| item_idPK | BIGINT | Unique monday item identifier |
| created_at | TIMESTAMPTZ | Timestamp when the item was created |
| Column | Type | Description |
|---|---|---|
| item_idPK | BIGINT | monday item identifier associated with the completion event |
| completed_at | TIMESTAMPTZ | Timestamp when the item was completed |