Your question is Window Functions for Top Users. 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.
LexisNexis Legal & Professional wants to understand engagement with Lexis+. Write a PostgreSQL query that identifies the three users with the greatest total session duration within each region.
user_id, and return only ranks 1 through 3.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique user identifier |
| user_name | VARCHAR(100) | User display name |
| region | VARCHAR(50) | User geographic region |
| Column | Type | Description |
|---|---|---|
| session_idPK | INT | Unique session identifier |
| user_id | INT | User associated with the session |
| session_duration_seconds | INT | Session duration in seconds |