Session Rank
A medium SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.
- Domain
- SQL
- Difficulty
- medium
- Seniority
- L4
Problem
Analytics wants to see each user's sessions ranked by engagement. Within each user, number their sessions from longest to shortest by session_duration_sec. Skip rows where session_duration_sec is NULL. Return the user_id, duration, and position number.
Summary
Longest sessions rise to the top. Within each user, a pecking order.
Practice This Problem
Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a real database and grades it automatically.