AnalystPath

Uninterrupted Study Sessions

SQLEasyJunior level~15 min

Problem

A focus app records each user's study sessions and any notification pings sent to them.

```
StudySession
+------------+------+
| Column | Type |
+------------+------+
| session_id | int |
| user_id | int |
| start_min | int |
| end_min | int |
+------------+------+
session_id is the primary key. start_min/end_min are minute offsets within a day.

Ping
+----------+------+
| Column | Type |
+----------+------+
| ping_id | int |
| user_id | int |
| at_min | int |
+----------+------+
ping_id is the primary key. at_min is the minute the ping fired.
```

Report the `session_id` of every study session during which the same user received **no** ping. A ping interrupts a session if it fired at any minute from `start_min` to `end_min`, inclusive.

Return the result in any order.

Tables

Example rows — the live problem includes the full dataset.

StudySession
session_iduser_idstart_minend_min
1115
211523
321012
Ping
ping_iduser_idat_min
115
2217
31220

Expected output

Your answer should return 3 rows with the columns session_id.

Starter code (SQL)

SELECT *
FROM StudySession;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions