View
slot_availability
Booked, admitted and remaining places for every dated slot. Replaces the stored 2020 count.
Rows 51–75 of 443
| slot_idINTEGER | exhibition_idINTEGER | titleTEXT | slot_dateTEXT | start_timeTEXT | capacityINTEGER | bookedany | admittedany | remainingany |
|---|---|---|---|---|---|---|---|---|
| 51 | 3 | Quiet Rooms: Dutch Domestic Painting | 2016-04-24 | 11:45 | 45 | 4 | 3 | 41 |
| 52 | 3 | Quiet Rooms: Dutch Domestic Painting | 2016-04-28 | 14:45 | 45 | 2 | 2 | 43 |
| 53 | 3 | Quiet Rooms: Dutch Domestic Painting | 2016-05-01 | 13:30 | 45 | 3 | 3 | 42 |
| 54 | 3 | Quiet Rooms: Dutch Domestic Painting | 2016-05-04 | 10:30 | 45 | 1 | 1 | 44 |
| 55 | 3 | Quiet Rooms: Dutch Domestic Painting | 2016-05-04 | 13:15 | 45 | 1 | 0 | 44 |
| 56 | 3 | Quiet Rooms: Dutch Domestic Painting | 2016-05-06 | 15:15 | 45 | 1 | 1 | 44 |
| 57 | 3 | Quiet Rooms: Dutch Domestic Painting | 2016-05-08 | 15:15 | 45 | 2 | 2 | 43 |
| 58 | 3 | Quiet Rooms: Dutch Domestic Painting | 2016-05-16 | 12:45 | 45 | 1 | 1 | 44 |
| 59 | 3 | Quiet Rooms: Dutch Domestic Painting | 2016-05-18 | 16:15 | 45 | 2 | 2 | 43 |
| 60 | 3 | Quiet Rooms: Dutch Domestic Painting | 2016-05-22 | 14:30 | 45 | 4 | 4 | 41 |
| 61 | 3 | Quiet Rooms: Dutch Domestic Painting | 2016-05-25 | 12:00 | 45 | 2 | 2 | 43 |
| 62 | 3 | Quiet Rooms: Dutch Domestic Painting | 2016-05-25 | 12:15 | 45 | 3 | 3 | 42 |
| 63 | 3 | Quiet Rooms: Dutch Domestic Painting | 2016-05-27 | 13:00 | 45 | 2 | 2 | 43 |
| 64 | 3 | Quiet Rooms: Dutch Domestic Painting | 2016-05-27 | 16:00 | 45 | 1 | 1 | 44 |
| 65 | 3 | Quiet Rooms: Dutch Domestic Painting | 2016-05-28 | 11:45 | 45 | 1 | 1 | 44 |
| 66 | 3 | Quiet Rooms: Dutch Domestic Painting | 2016-05-29 | 15:30 | 45 | 2 | 2 | 43 |
| 67 | 4 | Paper Masters: Renaissance Drawings | 2016-06-24 | 10:45 | 30 | 2 | 2 | 28 |
| 68 | 4 | Paper Masters: Renaissance Drawings | 2016-06-27 | 13:30 | 30 | 4 | 4 | 26 |
| 69 | 4 | Paper Masters: Renaissance Drawings | 2016-06-29 | 15:45 | 30 | 1 | 1 | 29 |
| 70 | 4 | Paper Masters: Renaissance Drawings | 2016-07-01 | 14:15 | 30 | 30 | 29 | 0 |
| 71 | 4 | Paper Masters: Renaissance Drawings | 2016-07-01 | 14:30 | 30 | 28 | 27 | 2 |
| 72 | 4 | Paper Masters: Renaissance Drawings | 2016-07-07 | 10:45 | 30 | 1 | 1 | 29 |
| 73 | 4 | Paper Masters: Renaissance Drawings | 2016-07-24 | 11:00 | 30 | 1 | 1 | 29 |
| 74 | 4 | Paper Masters: Renaissance Drawings | 2016-08-25 | 12:15 | 30 | 5 | 4 | 25 |
| 75 | 5 | Scribes of the Nile | 2016-10-12 | 11:15 | 45 | 2 | 2 | 43 |
View definition
CREATE VIEW slot_availability AS
SELECT
s.slot_id,
s.exhibition_id,
e.title,
s.slot_date,
s.start_time,
s.capacity,
count(b.booking_id) AS booked,
count(h.scan_id) AS admitted,
s.capacity - count(b.booking_id) AS remaining
FROM exhibition_slot s
JOIN exhibition e ON e.exhibition_id = s.exhibition_id
LEFT JOIN exhibition_booking b ON b.slot_id = s.slot_id
LEFT JOIN hall_napoleon_scan h ON h.booking_id = b.booking_id
GROUP BY s.slot_id;