Changes between Version 2 and Version 3 of RSVPConversion
- Timestamp:
- 05/13/26 21:49:53 (13 days ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
RSVPConversion
v2 v3 3 3 == 3. Scenario Overview == 4 4 5 This scenario analyzes RSVP response efficiency and attendance conversion for wedding events. 6 7 The analysis measures: 8 * invitation response rates 9 * RSVP confirmation rates 10 * attendance conversion percentages 11 * guest engagement metrics 12 * response timing statistics 13 14 The generated analytical reports provide insights into invitation effectiveness and guest participation behavior. 5 This scenario analyzes RSVP conversion efficiency and guest engagement across wedding events. 6 7 The analysis combines: 8 * guest invitations 9 * RSVP responses 10 * attendance records 11 * response rates 12 * attendance conversion metrics 13 14 The report enables: 15 * invitation effectiveness analysis 16 * guest engagement tracking 17 * attendance prediction 18 * RSVP monitoring 19 * response behavior analysis 15 20 16 21 == 3.1 Objective == … … 18 23 Quantify the conversion efficiency from guest invitations to confirmed attendance across wedding events. 19 24 20 The analysis calculates: 21 * RSVP response rates 22 * confirmation percentages 23 * attendance conversion metrics 24 * average response timing before events 25 26 The scenario demonstrates how analytical SQL queries can be used to evaluate guest engagement patterns. 25 This report calculates RSVP response rates, conversion metrics from response to actual attendance, and temporal analysis of guest response patterns. 26 27 The analysis identifies invitation effectiveness and guest engagement trends. 27 28 28 29 == 3.2 SQL Query Implementation == … … 42 43 43 44 e.event_id, 44 45 45 e.event_type, 46 46 … … 51 51 AS rsvp_responses, 52 52 53 COUNT( 54 DISTINCT CASE 55 WHEN r.status = 'CONFIRMED' 56 THEN r.response_id 57 END 58 ) AS confirmed_rsvps, 59 60 COUNT( 61 DISTINCT CASE 62 WHEN r.status = 'DECLINED' 63 THEN r.response_id 64 END 65 ) AS declined_rsvps, 53 COUNT(DISTINCT CASE 54 WHEN r.status = 'CONFIRMED' 55 THEN r.response_id 56 END) AS confirmed_rsvps, 57 58 COUNT(DISTINCT CASE 59 WHEN r.status = 'DECLINED' 60 THEN r.response_id 61 END) AS declined_rsvps, 66 62 67 63 COUNT(DISTINCT a.attendance_id) 68 64 AS attendance_records, 69 65 70 COUNT( 71 DISTINCT CASE 72 WHEN a.status = 'ATTENDED' 73 THEN a.attendance_id 74 END 75 ) AS actual_attendees, 66 COUNT(DISTINCT CASE 67 WHEN a.status = 'ATTENDED' 68 THEN a.attendance_id 69 END) AS actual_attendees, 76 70 77 71 ROUND( … … 87 81 ( 88 82 CAST( 89 COUNT( 90 DISTINCT CASE 91 WHEN r.status = 'CONFIRMED' 92 THEN r.response_id 93 END 94 ) AS NUMERIC 83 COUNT(DISTINCT CASE 84 WHEN r.status = 'CONFIRMED' 85 THEN r.response_id 86 END) AS NUMERIC 95 87 ) 96 88 / … … 103 95 ( 104 96 CAST( 105 COUNT( 106 DISTINCT CASE 107 WHEN a.status = 'ATTENDED' 108 THEN a.attendance_id 109 END 110 ) AS NUMERIC 97 COUNT(DISTINCT CASE 98 WHEN a.status = 'ATTENDED' 99 THEN a.attendance_id 100 END) AS NUMERIC 111 101 ) 112 102 / 113 103 NULLIF( 114 COUNT( 115 DISTINCT CASE 116 WHEN r.status = 'CONFIRMED' 117 THEN r.response_id 118 END 119 ), 104 COUNT(DISTINCT CASE 105 WHEN r.status = 'CONFIRMED' 106 THEN r.response_id 107 END), 120 108 0 121 109 ) … … 158 146 == 3.3 Query Complexity Analysis == 159 147 160 * Join Count: 161 * 6 tables 162 148 * Join Count: 6 tables 163 149 * Join Types: 164 150 * INNER JOIN … … 170 156 * NULLIF() 171 157 172 * Conditional Aggregation:173 * CASE WHEN logic inside COUNT()174 175 158 * Conversion Metrics: 176 159 * RSVP response rate 177 160 * confirmation rate 178 * attendance conversion percentage 161 * attendance conversion rate 162 163 * Conditional Aggregation: 164 * CASE WHEN logic inside COUNT() 179 165 180 166 == 3.4 Relational Algebra Expression == … … 186 172 w.date, 187 173 e.event_id, 188 e.event_type, 189 190 COUNT(g.guest_id), 191 192 COUNT(r.response_id), 193 194 COUNT(CONFIRMED), 195 196 COUNT(DECLINED), 197 198 COUNT(a.attendance_id), 199 200 COUNT(ATTENDED) 174 e.event_type 201 175 ) 202 176 … … 223 197 * γ = Grouping and aggregation 224 198 * ⟕ = Left outer join 225 * COUNT(DISTINCT ...) = Distinct aggregation 226 * CASE = Conditional aggregation 199 * COUNT(DISTINCT ...) = distinct counting 227 200 228 201 === Interpretation === 229 202 230 The expression combines weddings, guests, RSVP responses, and attendance records in order to calculate RSVP conversion metrics. 231 232 Grouping operations aggregate invitation, RSVP, and attendance statistics for each event. 203 The expression combines wedding, event, guest, RSVP, and attendance relations to calculate guest engagement and RSVP conversion metrics. 233 204 234 205 == 3.5 PostgreSQL Stored Procedure == … … 238 209 {{{ 239 210 #!sql 240 CREATE OR REPLACE PROCEDURE 241 rsvp_conversion_report( 211 CREATE OR REPLACE PROCEDURE rsvp_conversion_report( 242 212 243 213 IN p_wedding_id INT DEFAULT NULL, 244 245 214 IN p_event_type VARCHAR DEFAULT NULL, 246 247 215 IN p_min_response_rate NUMERIC DEFAULT 0, 248 249 216 IN p_max_response_rate NUMERIC DEFAULT 100 217 250 218 ) 251 252 219 LANGUAGE plpgsql 253 254 220 AS $$ 255 221 … … 257 223 258 224 v_wedding_record RECORD; 259 260 225 v_event_record RECORD; 261 226 262 227 v_total_invitations INTEGER; 263 264 228 v_rsvp_responses INTEGER; 265 229 266 230 v_confirmed_rsvps INTEGER; 267 268 231 v_declined_rsvps INTEGER; 269 232 270 233 v_attendance_records INTEGER; 271 272 234 v_actual_attendees INTEGER; 273 235 274 236 v_rsvp_rate NUMERIC; 275 276 237 v_confirmation_rate NUMERIC; 277 278 238 v_attendance_rate NUMERIC; 279 239 … … 283 243 284 244 wedding_id INTEGER, 285 286 245 organizer_name VARCHAR, 287 288 246 wedding_date DATE, 289 247 290 248 event_id INTEGER, 291 292 249 event_type VARCHAR, 293 250 294 251 total_invitations INTEGER, 295 296 252 rsvp_responses INTEGER, 297 253 298 254 confirmed_rsvps INTEGER, 299 300 255 declined_rsvps INTEGER, 301 256 302 257 attendance_records INTEGER, 303 304 258 actual_attendees INTEGER, 305 259 306 260 rsvp_response_rate_percent NUMERIC, 307 308 261 confirmation_rate_percent NUMERIC, 309 310 262 attendance_conversion_percent NUMERIC 263 311 264 ); 312 265 … … 325 278 326 279 WHERE 327 ( 328 p_wedding_id IS NULL 329 OR w.wedding_id = p_wedding_id 330 ) 280 (p_wedding_id IS NULL 281 OR w.wedding_id = p_wedding_id) 331 282 332 283 LOOP … … 341 292 342 293 WHERE 343 e.wedding_id = 344 v_wedding_record.wedding_id 345 294 e.wedding_id = v_wedding_record.wedding_id 346 295 AND ( 347 296 p_event_type IS NULL … … 352 301 353 302 SELECT COUNT(DISTINCT g.guest_id) 354 355 303 INTO v_total_invitations 356 357 304 FROM guest g 358 359 WHERE 360 g.wedding_id = 361 v_wedding_record.wedding_id; 305 WHERE g.wedding_id = v_wedding_record.wedding_id; 362 306 363 307 SELECT COUNT(DISTINCT r.response_id) 364 365 308 INTO v_rsvp_responses 366 367 309 FROM event_rsvp r 368 369 WHERE 370 r.event_id = 371 v_event_record.event_id; 310 WHERE r.event_id = v_event_record.event_id; 372 311 373 312 SELECT COUNT(DISTINCT r.response_id) 374 375 313 INTO v_confirmed_rsvps 376 377 314 FROM event_rsvp r 378 379 WHERE 380 r.event_id = 381 v_event_record.event_id 382 383 AND r.status = 'CONFIRMED'; 315 WHERE r.event_id = v_event_record.event_id 316 AND r.status = 'CONFIRMED'; 384 317 385 318 SELECT COUNT(DISTINCT r.response_id) 386 387 319 INTO v_declined_rsvps 388 389 320 FROM event_rsvp r 390 391 WHERE 392 r.event_id = 393 v_event_record.event_id 394 395 AND r.status = 'DECLINED'; 321 WHERE r.event_id = v_event_record.event_id 322 AND r.status = 'DECLINED'; 396 323 397 324 SELECT COUNT(DISTINCT a.attendance_id) 398 399 325 INTO v_attendance_records 400 401 326 FROM attendance a 402 403 WHERE 404 a.event_id = 405 v_event_record.event_id; 327 WHERE a.event_id = v_event_record.event_id; 406 328 407 329 SELECT COUNT(DISTINCT a.attendance_id) 408 409 330 INTO v_actual_attendees 410 411 331 FROM attendance a 412 413 WHERE 414 a.event_id = 415 v_event_record.event_id 416 417 AND a.status = 'ATTENDED'; 332 WHERE a.event_id = v_event_record.event_id 333 AND a.status = 'ATTENDED'; 418 334 419 335 v_total_invitations := … … 429 345 COALESCE(v_declined_rsvps, 0); 430 346 431 v_attendance_records :=432 COALESCE(v_attendance_records, 0);433 434 v_actual_attendees :=435 COALESCE(v_actual_attendees, 0);436 437 347 IF v_total_invitations > 0 THEN 438 348 439 v_rsvp_rate := 440 ROUND( 441 ( 442 CAST(v_rsvp_responses AS NUMERIC) 443 / v_total_invitations 444 ) * 100, 445 2 446 ); 349 v_rsvp_rate := ROUND( 350 ( 351 CAST(v_rsvp_responses AS NUMERIC) 352 / v_total_invitations 353 ) * 100, 354 2 355 ); 447 356 448 357 ELSE … … 454 363 IF v_rsvp_responses > 0 THEN 455 364 456 v_confirmation_rate := 457 ROUND( 458 ( 459 CAST(v_confirmed_rsvps AS NUMERIC) 460 / v_rsvp_responses 461 ) * 100, 462 2 463 ); 365 v_confirmation_rate := ROUND( 366 ( 367 CAST(v_confirmed_rsvps AS NUMERIC) 368 / v_rsvp_responses 369 ) * 100, 370 2 371 ); 464 372 465 373 ELSE … … 471 379 IF v_confirmed_rsvps > 0 THEN 472 380 473 v_attendance_rate := 474 ROUND( 475 ( 476 CAST(v_actual_attendees AS NUMERIC) 477 / v_confirmed_rsvps 478 ) * 100, 479 2 480 ); 381 v_attendance_rate := ROUND( 382 ( 383 CAST(v_actual_attendees AS NUMERIC) 384 / v_confirmed_rsvps 385 ) * 100, 386 2 387 ); 481 388 482 389 ELSE … … 488 395 IF v_rsvp_rate BETWEEN 489 396 p_min_response_rate 490 AND 491 p_max_response_rate 492 397 AND p_max_response_rate 493 398 THEN 494 399 495 400 INSERT INTO rsvp_conversion_results 496 497 401 VALUES ( 498 499 402 v_wedding_record.wedding_id, 500 501 v_wedding_record.first_name || ' ' 502 || v_wedding_record.last_name, 503 403 v_wedding_record.first_name || ' ' || v_wedding_record.last_name, 504 404 v_wedding_record.date, 505 506 405 v_event_record.event_id, 507 508 406 v_event_record.event_type, 509 510 407 v_total_invitations, 511 512 408 v_rsvp_responses, 513 514 409 v_confirmed_rsvps, 515 516 410 v_declined_rsvps, 517 518 411 v_attendance_records, 519 520 412 v_actual_attendees, 521 522 413 v_rsvp_rate, 523 524 414 v_confirmation_rate, 525 526 415 v_attendance_rate 527 416 ); … … 535 424 RAISE NOTICE 536 425 'RSVP Conversion Report Generated - % events processed', 537 538 426 ( 539 427 SELECT COUNT(*) … … 548 436 549 437 * Nested Loop Logic: 550 * iteration through weddings and events551 552 * ConversionMetrics:553 * RSVPresponse rate438 * weddings and events iteration 439 440 * RSVP Metrics: 441 * response rate 554 442 * confirmation rate 555 443 * attendance conversion rate … … 560 448 561 449 * Filtering: 562 * response rate intervalfiltering563 564 * Dynamic Parameters: 565 * optional wedding filtering 566 * optional event type filtering450 * event type filtering 451 * response rate filtering 452 453 * Reporting: 454 * session-scoped temporary table 567 455 568 456 == 3.7 Proof of Execution with Sample Data == … … 579 467 ) 580 468 VALUES ( 581 ' Александар',582 'Николов ски',583 ' aleksandar.n@email.com',584 '071- 222-333'469 'Марко', 470 'Николов', 471 'marko@email.com', 472 '071-333-444' 585 473 ); 586 474 … … 595 483 3 596 484 ); 485 486 INSERT INTO event ( 487 event_type, 488 date, 489 start_time, 490 end_time, 491 status, 492 wedding_id 493 ) 494 VALUES ( 495 'Ceremony', 496 '2024-08-10', 497 '14:00:00', 498 '15:00:00', 499 'SCHEDULED', 500 3 501 ); 597 502 }}} 598 503 … … 600 505 601 506 {{{ 602 wedding_id | organizer_name | total_invitations603 ------------+---------------- -------+-------------------604 3 | Aleksandar Nikolovski| 15507 wedding_id | organizer_name | event_type | invitations 508 ------------+----------------+------------+------------- 509 3 | Марко Николов | Ceremony | 15 605 510 }}} 606 511 … … 611 516 612 517 * RSVP Responses: 613 * total RSVP replies518 * guests who submitted RSVP responses 614 519 615 520 * Confirmed RSVPs: 616 * guests who accepted invitations 617 618 * Declined RSVPs: 619 * guests who rejected invitations 521 * responses with CONFIRMED status 620 522 621 523 * Attendance Conversion: 622 * ratio between confirmed RSVPs and actual attendance 524 * actual attendees compared to confirmed RSVPs 525 526 * Response Rate: 527 * RSVP responses relative to invitations 623 528 624 529 == Summary == 625 530 626 This scenario demonstrates advanced RSVP analytics using:627 * analytical SQL queries628 * conditional aggregation629 * conversion metrics630 * PostgreSQL stored procedures631 * attendance analysis632 * guest engagement reporting531 This scenario demonstrates: 532 * RSVP analytics 533 * guest engagement tracking 534 * attendance conversion analysis 535 * aggregate SQL reporting 536 * stored procedures 537 * advanced event analytics
