Task
You are given a table of Discord user gaming sessions. Write a SQL query to find the top 5 games played by users who joined Discord in the last 30 days. Return each game and the number of sessions played by those newly joined users, ordered from most played to least played.
This is an easy SQL question, so solve it using only the single table provided. Assume each row represents one game session, and use CURRENT_DATE as the reference date for the 30-day filter.
Schema
| column_name | type | description |
|---|
| session_id | INT | Unique session identifier |
| user_id | INT | Discord user identifier |
| username | VARCHAR(50) | Discord username |
| joined_date | DATE | Date the user joined Discord |
| game_name | VARCHAR(100) | Name of the game played |
| session_minutes | INT | Length of the game session in minutes |
Sample data
| session_id | user_id | username | joined_date | game_name | session_minutes |
|---|
| 4 | 104 | pixelpanda | 2025-05-20 | VALORANT | 90 |
| 1 | 101 | nova | 2025-05-10 | Fortnite | 45 |
| 7 | 107 | echo | 2025-04-15 | League of Legends | 50 |
| 2 | 102 | bytebard | 2025-05-02 | Minecraft | 60 |
| 10 | 110 | luna | 2025-05-18 | VALORANT | 20 |
Expected output
| game_name | play_count |
|---|
| VALORANT | 3 |
| Minecraft | 2 |
| Fortnite | 2 |
| Apex Legends | 1 |
| Roblox | 1 |