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.
Requirements
- Start with every item in
item_created_events, including items without a completion event.
- Join a matching completion event from
item_completed_events using item_id.
- Return the elapsed time in hours as
delta_hours, rounded to two decimal places. Return NULL when the completion timestamp is unavailable.
- Order the results chronologically by the creation timestamp.