Write a SQL query to identify the top 5% of users based on daily active usage over the last quarter.
For this exercise, treat the last quarter as April 1, 2026 through June 30, 2026. Calculate each active user's average daily usage, exclude activity outside that period, and use user_id as the tie-breaker.
user_id, user_name, avg_daily_usage, and usage_rank.usage_rank, then user_id.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique user identifier |
| user_name | VARCHAR(100) | User display name |
| Column | Type | Description |
|---|---|---|
| activity_idPK | INT | Unique activity record identifier |
| user_id | INT | User associated with the activity |
| activity_date | DATE | Calendar date of recorded usage |
| usage_seconds | INT | Usage duration in seconds |