| 3 | | == Content |
| 4 | | To be defined. |
| | 3 | == Description |
| | 4 | This phase demonstrates typical application scenarios for accessing the Wedding Planner database using SQL queries. |
| | 5 | The scenarios reflect real tasks such as creating weddings, managing events and guests, tracking attendance, and handling venue bookings. |
| | 6 | |
| | 7 | == Assumptions |
| | 8 | * Primary keys are generated by the system (or assigned manually for the examples). |
| | 9 | * table_number in Attendance is optional because not all events require seating arrangements. |
| | 10 | * Status values are stored as text (e.g., 'planned', 'confirmed', 'cancelled', 'attending'). |
| | 11 | |
| | 12 | == Scenario 1: Register a new user |
| | 13 | Create a new user who will manage weddings in the system. |
| | 14 | |
| | 15 | {{{ |
| | 16 | INSERT INTO User (user_id, first_name, last_name, email, phone_number, gender, birthday) |
| | 17 | VALUES (10, 'Jana', 'Trpkovska', 'jana@mail.com', '070123456', 'F', '2002-05-10'); |
| | 18 | }}} |
| | 19 | |
| | 20 | == Scenario 2: Create a wedding for a user |
| | 21 | A user creates a wedding record. |
| | 22 | |
| | 23 | {{{ |
| | 24 | INSERT INTO Wedding (wedding_id, date, budget, notes, user_id) |
| | 25 | VALUES (1, '2026-06-20', 15000, 'Summer wedding', 10); |
| | 26 | }}} |
| | 27 | |
| | 28 | == Scenario 3: Add events for a wedding |
| | 29 | Create wedding-related events such as ceremony and reception. |
| | 30 | |
| | 31 | {{{ |
| | 32 | INSERT INTO Event (event_id, event_type, date, start_time, end_time, status, wedding_id) |
| | 33 | VALUES |
| | 34 | (1, 'Ceremony', '2026-06-20', '12:00:00', '13:00:00', 'planned', 1), |
| | 35 | (2, 'Reception', '2026-06-20', '15:00:00', '21:00:00', 'planned', 1); |
| | 36 | }}} |
| | 37 | |
| | 38 | == Scenario 4: Add guests to a wedding |
| | 39 | Add invited guests to the wedding. |
| | 40 | |
| | 41 | {{{ |
| | 42 | INSERT INTO Guest (guest_id, first_name, last_name, email, wedding_id) |
| | 43 | VALUES |
| | 44 | (101, 'Ana', 'Petrova', 'ana.p@mail.com', 1), |
| | 45 | (102, 'Marko', 'Iliev', 'marko.i@mail.com', 1), |
| | 46 | (103, 'Elena', 'Stojanova', NULL, 1); |
| | 47 | }}} |
| | 48 | |
| | 49 | == Scenario 5: Record attendance for an event |
| | 50 | Track guest attendance for a specific event (e.g., reception). table_number is optional. |
| | 51 | |
| | 52 | {{{ |
| | 53 | INSERT INTO Attendance (attendance_id, status, role, table_number, guest_id, event_id) |
| | 54 | VALUES |
| | 55 | (1, 'attending', 'guest', 5, 101, 2), |
| | 56 | (2, 'attending', 'best_man', 1, 102, 2), |
| | 57 | (3, 'pending', 'guest', NULL, 103, 2); |
| | 58 | }}} |
| | 59 | |
| | 60 | == Scenario 6: List all weddings for a specific user |
| | 61 | Retrieve weddings managed by a given user. |
| | 62 | |
| | 63 | {{{ |
| | 64 | SELECT w.wedding_id, w.date, w.budget, w.notes |
| | 65 | FROM Wedding w |
| | 66 | WHERE w.user_id = 10 |
| | 67 | ORDER BY w.date; |
| | 68 | }}} |
| | 69 | |
| | 70 | == Scenario 7: List all events for a wedding |
| | 71 | Show all events for a selected wedding. |
| | 72 | |
| | 73 | {{{ |
| | 74 | SELECT e.event_id, e.event_type, e.date, e.start_time, e.end_time, e.status |
| | 75 | FROM Event e |
| | 76 | WHERE e.wedding_id = 1 |
| | 77 | ORDER BY e.date, e.start_time; |
| | 78 | }}} |
| | 79 | |
| | 80 | == Scenario 8: Show guest list for a wedding |
| | 81 | Retrieve all guests invited to a wedding. |
| | 82 | |
| | 83 | {{{ |
| | 84 | SELECT g.guest_id, g.first_name, g.last_name, g.email |
| | 85 | FROM Guest g |
| | 86 | WHERE g.wedding_id = 1 |
| | 87 | ORDER BY g.last_name, g.first_name; |
| | 88 | }}} |
| | 89 | |
| | 90 | == Scenario 9: Attendance overview for an event (JOIN) |
| | 91 | List guests with their attendance status and seating (if available) for a specific event. |
| | 92 | |
| | 93 | {{{ |
| | 94 | SELECT g.first_name, g.last_name, a.status, a.role, a.table_number |
| | 95 | FROM Attendance a |
| | 96 | JOIN Guest g ON a.guest_id = g.guest_id |
| | 97 | WHERE a.event_id = 2 |
| | 98 | ORDER BY a.role, g.last_name; |
| | 99 | }}} |
| | 100 | |
| | 101 | == Scenario 10: Update an event status |
| | 102 | Example: the ceremony is confirmed. |
| | 103 | |
| | 104 | {{{ |
| | 105 | UPDATE Event |
| | 106 | SET status = 'confirmed' |
| | 107 | WHERE event_id = 1; |
| | 108 | }}} |
| | 109 | |
| | 110 | == Scenario 11: Add venue types and venues |
| | 111 | Define venue types and store available venues. |
| | 112 | |
| | 113 | {{{ |
| | 114 | INSERT INTO Venue_Type (type_id, type_name) |
| | 115 | VALUES |
| | 116 | (1, 'Restaurant'), |
| | 117 | (2, 'Hotel'), |
| | 118 | (3, 'Event Hall'); |
| | 119 | }}} |
| | 120 | |
| | 121 | {{{ |
| | 122 | INSERT INTO Venue (venue_id, name, location, city, address, capacity, menu, phone_number, price_per_guest) |
| | 123 | VALUES |
| | 124 | (1, 'Royal Hall', 'Center', 'Skopje', 'Main Street 10', 250, 'Standard Menu', '021234567', 25.00), |
| | 125 | (2, 'Lakeview Hotel', 'Lake Area', 'Ohrid', 'Lake Road 5', 180, NULL, '046111222', 30.00); |
| | 126 | }}} |
| | 127 | |
| | 128 | == Scenario 12: Book a venue for a wedding (Venue_booking) |
| | 129 | Create a booking record for a specific venue and time interval. |
| | 130 | |
| | 131 | {{{ |
| | 132 | INSERT INTO Venue_booking (booking_id, date, start_time, end_time, status, price, wedding_id, venue_id) |
| | 133 | VALUES (1, '2026-06-20', '15:00:00', '21:00:00', 'confirmed', 4500.00, 1, 1); |
| | 134 | }}} |
| | 135 | |
| | 136 | == Scenario 13: Venue booking overview for a wedding (JOIN) |
| | 137 | Show booking details including venue name. |
| | 138 | |
| | 139 | {{{ |
| | 140 | SELECT v.name, vb.date, vb.start_time, vb.end_time, vb.status, vb.price |
| | 141 | FROM Venue_booking vb |
| | 142 | JOIN Venue v ON vb.venue_id = v.venue_id |
| | 143 | WHERE vb.wedding_id = 1 |
| | 144 | ORDER BY vb.date, vb.start_time; |
| | 145 | }}} |
| | 146 | |
| | 147 | == Scenario 14: Count guests per wedding (aggregate query) |
| | 148 | Useful for planning and estimating costs. |
| | 149 | |
| | 150 | {{{ |
| | 151 | SELECT w.wedding_id, COUNT(g.guest_id) AS total_guests |
| | 152 | FROM Wedding w |
| | 153 | LEFT JOIN Guest g ON w.wedding_id = g.wedding_id |
| | 154 | GROUP BY w.wedding_id |
| | 155 | ORDER BY w.wedding_id; |
| | 156 | }}} |
| | 157 | |
| | 158 | == Scenario 15: Estimated venue cost based on guest count |
| | 159 | Estimate total cost = price_per_guest * number_of_guests (for a selected venue and wedding). |
| | 160 | |
| | 161 | {{{ |
| | 162 | SELECT w.wedding_id, |
| | 163 | v.name AS venue_name, |
| | 164 | v.price_per_guest, |
| | 165 | COUNT(g.guest_id) AS guest_count, |
| | 166 | (v.price_per_guest * COUNT(g.guest_id)) AS estimated_total_cost |
| | 167 | FROM Wedding w |
| | 168 | JOIN Guest g ON w.wedding_id = g.wedding_id |
| | 169 | JOIN Venue v ON v.venue_id = 1 |
| | 170 | WHERE w.wedding_id = 1 |
| | 171 | GROUP BY w.wedding_id, v.name, v.price_per_guest; |
| | 172 | }}} |
| | 173 | |
| | 174 | == Conclusion |
| | 175 | These SQL scenarios demonstrate how the database supports the main wedding planning operations: |
| | 176 | user and wedding management, event scheduling, guest tracking, attendance recording, and venue bookings. |