You are given two tables: Playback and Ads.
The Playback table contains information about customer viewing sessions with start and end times. Each session has a unique session_id and belongs to a customer_id.
The Ads table contains information about ads shown to customers, with each ad having a unique ad_id, the customer_id who viewed it, and the timestamp when it was shown.
Task: Find all sessions that did not have any ads shown during them. A session runs during the inclusive interval between start_time and end_time. An ad is considered shown during a session if its timestamp falls within this interval.
Table Schema
| Column Name | Type | Description |
|---|---|---|
session_id
PK
|
int | Unique identifier for each session |
customer_id
|
int | ID of the customer watching this session |
start_time
|
int | Start time of the session |
end_time
|
int | End time of the session |
| Column Name | Type | Description |
|---|---|---|
ad_id
PK
|
int | Unique identifier for each ad |
customer_id
|
int | ID of the customer who viewed this ad |
timestamp
|
int | Time when the ad was shown |
Input & Output
| session_id | customer_id | start_time | end_time |
|---|---|---|---|
| 1 | 1 | 1 | 3 |
| 2 | 1 | 4 | 5 |
| 3 | 2 | 4 | 5 |
| ad_id | customer_id | timestamp |
|---|---|---|
| 1 | 1 | 5 |
| 2 | 2 | 6 |
| session_id |
|---|
| 1 |
| 3 |
Session 1 (customer 1, time 1-3): No ads shown during this period (ad was at time 5). Session 2 (customer 1, time 4-5): Has ad at time 5, so excluded. Session 3 (customer 2, time 4-5): No ads during this period (ad was at time 6).
| session_id | customer_id | start_time | end_time |
|---|---|---|---|
| 1 | 1 | 1 | 5 |
| 2 | 2 | 2 | 4 |
| ad_id | customer_id | timestamp |
|---|---|---|
| 1 | 1 | 3 |
| 2 | 2 | 4 |
| session_id |
|---|
No ad-free sessions exist. Session 1 has an ad at time 3 (within range 1-5), and session 2 has an ad at time 4 (within range 2-4).
Constraints
-
1 ≤ session_id, ad_id ≤ 100 -
1 ≤ customer_id ≤ 100 -
1 ≤ start_time ≤ end_time ≤ 300 -
1 ≤ timestamp ≤ 300