Calculate Daily Harmful Content View Percentage
Company: Meta
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: Medium
Interview Round: Technical Screen
VIDEOS
+----+-------------+------------+
| id | uploader_id | is_harmful |
+----+-------------+------------+
| 1 | 101 | true |
| 2 | 102 | false |
| 3 | 101 | true |
+----+-------------+------------+
VIEWS
+----------+---------+---------------------+
| video_id | user_id | view_time |
+----------+---------+---------------------+
| 1 | 1001 | 2023-07-01 10:00:00 |
| 2 | 1002 | 2023-07-01 10:01:00 |
| 1 | 1003 | 2023-07-01 10:02:00 |
+----------+---------+---------------------+
##### Scenario
A video-sharing platform wants to quantify how often users watch harmful content.
##### Question
Using the provided tables, write a SQL query that returns daily view_prevalence – the percentage of all views in a day that were on videos flagged as harmful.
##### Hints
Join videos to views; use SUM(CASE…) / COUNT(*) grouped by DATE(view_time).
Quick Answer: This question evaluates proficiency in data manipulation and aggregation for computing event-based metrics, testing competency in SQL/Python data processing within the Data Manipulation (SQL/Python) domain.