Your question is SQL: Median Session Duration. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Write a SQL query to find the median session duration per user segment.
Use the users and sessions tables. Exclude sessions with a NULL duration and users without a segment.
segment, median_duration_secondssegment| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique user identifier |
| user_name | VARCHAR(100) | User display name |
| segment | VARCHAR(50) | User segment |
| Column | Type | Description |
|---|---|---|
| session_idPK | INT | Unique session identifier |
| user_id | INT | User associated with the session |
| duration_seconds | INT | Session duration in seconds |