Finding Gaps in Timestamps for Multiple Users in PostgreSQL
问题 I am working with a dataset containing Check-In and Check-Out times for multiple office rooms over the last 5 years. One of the projects I was asked to work on was calculating the amount of time each room is busy and vacant over various time ranges (daily, weekly, monthly, etc.) assuming normal operational hours (8am to 5pm). A sample of the dataset for two days looks like this: room_id start_dt end_dt Room: Room 3 2019-05-04 09:00:00 2019-05-04 11:30:00 Room: Room 3 2019-05-04 11:30:00 2019