Write a SQL query to identify the top 5% of users based on daily active usage over the last quarter at Okta.
Treat daily active usage as the number of distinct calendar days on which each user generated usage. Use the users and usage_events tables, and include users with no qualifying activity when determining the percentile.
user_id, user_name, active_days, and usage_rankactive_days descending, then user_id ascending| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique Okta user identifier |
| user_name | VARCHAR(100) | User display name |
| VARCHAR(255) | User email address |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique usage event identifier |
| user_id | INT | User associated with the event |
| activity_date | DATE | Calendar date when usage occurred |
| usage_type | VARCHAR(50) | Type of Okta product activity |