Loading...
Active User Penetration Rate
A hard SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.
- Domain
- SQL
- Difficulty
- hard
- Seniority
- senior
Problem
The product analytics team defines an active user on a given device type as someone whose most recent session on that device is within the last 30 days, who has logged at least 5 sessions, and whose total session time on that device is at least 10 hours (36,000 seconds). For each device type, calculate the penetration rate: the number of active users divided by the total number of users on that device. Include device types where no users meet the active threshold, showing a zero rate. Return the device type and penetration rate.
Practice This Problem
Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a live PostgreSQL database and grades it instantly.