Grokking SQL for Tech Interviews
Vote
0% completed
19. Ad-Free Sessions
Problem
Table: Playback
+-------------+------+
| Column Name | Type |
+-------------+------+
| session_id | int |
| customer_id | int |
| start_time | int |
| end_time | int |
+-------------+------+
session_id is the column with unique values for this table.
customer_id is the ID of the customer watching this session.
The session runs during the inclusive interval between start_time and end_time.
It is guaranteed that start_time <= end_time and that two sessions for the same customer do not intersect.
Table: Ads
+-------------+------+
| Column Name | Type |
.....
.....
.....
Like the course? Get enrolled and start learning!
Christopher Guy Slater
· 6 days ago
SELECT session_id FROM Playback p WHERE NOT EXISTS( SELECT 1 FROM Ads a WHERE p.customer_id = a.customer_id AND a.timestamp BETWEEN p.start_time AND p.end_time );
Reading Progress
0%