Assignment Query Desk
shows venue usage and crowd strength while keeping arenas with partial game history in scope through LEFT JOIN.
Query brief
Arenas that hosted at least 20 games.
capture the result grid in phpMyAdmin after running the query.
SELECT
a.arena_name,
a.city,
COUNT(g.game_id) AS games_hosted,
ROUND(AVG(g.attendance), 0) AS avg_attendance,
MAX(g.attendance) AS peak_attendance
FROM arenas a
LEFT JOIN games g ON g.arena_id = a.arena_id
LEFT JOIN teams t ON t.home_arena_id = a.arena_id
GROUP BY a.arena_id, a.arena_name, a.city
HAVING COUNT(g.game_id) >= 20
ORDER BY games_hosted DESC, avg_attendance DESC;
Live result
| Arena Name | City | Games Hosted | Avg Attendance | Peak Attendance |
|---|---|---|---|---|
| Peace and Friendship Stadium | Piraeus | 176 | 10389 | 11484 |
| Mediolanum Forum | Milan | 158 | 9853 | 11532 |
| Menora Mivtachim Arena | Tel Aviv | 156 | 8756 | 9996 |
| Uber Arena | Berlin | 140 | 10047 | 11832 |
| Stark Arena | Belgrade | 136 | 15352 | 17748 |
| Palau Blaugrana | Barcelona | 128 | 6324 | 7342 |
| Zalgirio Arena | Kaunas | 120 | 13776 | 15246 |
| Adidas Arena | Paris | 117 | 5749 | 6944 |
| Salle Gaston Medecin | Monaco | 100 | 4043 | 4670 |
| Ulker Sports and Event Hall | Istanbul | 99 | 11680 | 13365 |