Analyze User Flags and Review Outcomes for Moderation Prioritization
Company: Google
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: Medium
Interview Round: Technical Screen
UserFlags
+---------------+--------------+----------+---------+
| User_FirstName| User_LastName| Video_ID | Flag_ID |
+---------------+--------------+----------+---------+
| Alice | Zhang | v1 | f101 |
| Bob | Singh | v1 | f102 |
| Alice | Zhang | v2 | f103 |
| Carol | Lee | v3 | f104 |
| Bob | Singh | v3 | f105 |
+---------------+--------------+----------+---------+
FlagReviews
+----------+---------+--------------+-----------------+
| Video_ID | Flag_ID | Reviewed_date| Reviewed_outcome|
+----------+---------+--------------+-----------------+
| v1 | f101 | 2023-01-02 | APPROVED |
| v1 | f102 | 2023-01-03 | REJECTED |
| v2 | f103 | 2023-01-05 | APPROVED |
| v3 | f104 | 2023-01-04 | APPROVED |
| v3 | f105 | NULL | NULL |
+----------+---------+--------------+-----------------+
##### Scenario
YouTube Trust & Safety team wants to analyze user-generated video flags and their review outcomes to prioritize moderation resources.
##### Question
Q1. Given table UserFlags(User_FirstName, User_LastName, Video_ID, Flag_ID), write a SQL query that returns, for every Video_ID, the number of flags submitted by distinct users. Q2. Using UserFlags and FlagReviews(Video_ID, Flag_ID, Reviewed_date, Reviewed_outcome), find the count of flags reviewed by YouTube for the single video that received the highest total number of user flags. Q3. Combining both tables, determine which user (concatenate first and last name) flagged the greatest number of videos that were ultimately APPROVED by YouTube. Q4. Write a query that lists every row from any provided table where at least one column contains NULL.
##### Hints
Think joins, distinct counts, grouping, and IS NULL filters. For Q3, count unique Video_IDs per user where Reviewed_outcome = 'APPROVED'.
Quick Answer: This question evaluates a data scientist's proficiency in SQL-based data manipulation, including joins, distinct counting and grouping, aggregations, string concatenation for user identity, and NULL handling across event and review tables.