Identify Top Three Active Users by Event Date
Company: Meta
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: medium
Interview Round: Onsite
Overview: This question evaluates proficiency in SQL-based data aggregation and ranking techniques applied to event logs, testing skills such as grouping, counting, and the use of window/ranking functions to identify top users by date.
Tables
event_log(event_date DATE, user_id INTEGER, event_type VARCHAR, event_timestamp TIMESTAMP)
Hints
- Aggregate counts per (event_date, user_id).
- Apply ROW_NUMBER() over each event_date partition ordered by event_count DESC (and user_id ASC as a tiebreaker), then filter to row_number <= 3.