Final RSVP Status per Guest for Facebook Events

Last updated: November 29, 2026

Quick Overview

Guests can change their RSVP to a Facebook Event many times. For each event, return the number of guests whose latest RSVP is Going, Interested, and Can't Go.

Meta
Data Manipulation (SQL/Python)
Data Scientist
Meta
November 29, 2026
Data Scientist
Online Assessment
Data Manipulation (SQL/Python)
Easy

0

0

0 solved


Guests can change their RSVP to a Facebook Event many times. For each event, return the number of guests whose latest RSVP is Going, Interested, and Can't Go.

This is a common first SQL question in Meta's data science online assessment. The interviewer checks that you dedupe to the latest state per (event, guest) before counting.

What the Interviewer Expects
  • Dedupes to the latest RSVP per event and guest
  • Uses a deterministic window ordering
  • Pivots statuses with conditional aggregation
  • Includes events where a status has zero guests
  • Notes that counting raw rows overstates every status
Key Topics to Cover
latest state
ROW_NUMBER
conditional aggregation
deduplication
events
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How would you count guests who switched from Going to Can't Go in the last 24 hours before the event?
  • How would you exclude RSVPs made after the event started?
  • How would you include events with no RSVPs?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

event_rsvps(event_id, user_id, status, rsvp_at, rsvp_id) with status in ('going', 'interested', 'declined'). One row per change. rsvp_id is increasing and breaks ties....

Approach

Rank each guest's rows within an event by rsvp_at DESC, rsvp_id DESC, keep the first, then pivot with SUM(CASE ...) grouped by event....


Submit Your Answer
Markdown supported