Assignment Query Desk
gives you a fifteenth advanced query that still uses multiple tables, aggregation, LEFT JOIN, and HAVING while staying on your actual schema.
Query brief
Puzzle answer density by season and puzzle.
capture the result grid in phpMyAdmin after running the query.
SELECT
s.season_label,
gp.puzzle_name,
COUNT(DISTINCT gpc.row_position, gpc.column_position) AS cells,
COUNT(gpa.person_id) AS total_answers,
ROUND(COUNT(gpa.person_id) / NULLIF(COUNT(DISTINCT gpc.row_position, gpc.column_position), 0), 1) AS answers_per_cell
FROM grid_puzzles gp
INNER JOIN seasons s ON s.season_id = gp.season_id
INNER JOIN grid_puzzle_cells gpc ON gpc.grid_puzzle_id = gp.grid_puzzle_id
LEFT JOIN grid_puzzle_answers gpa
ON gpa.grid_puzzle_id = gpc.grid_puzzle_id
AND gpa.row_position = gpc.row_position
AND gpa.column_position = gpc.column_position
GROUP BY s.season_id, s.season_label, gp.grid_puzzle_id, gp.puzzle_name
HAVING COUNT(gpa.person_id) >= 5
ORDER BY s.season_id DESC, answers_per_cell DESC, gp.puzzle_name ASC;
Live result
| Season Label | Puzzle Name | Cells | Total Answers | Answers Per Cell |
|---|---|---|---|---|
| 2025-26 | Euroleague Grid 04 · FG% / 3P% / A/T | 9 | 36 | 4.0 |
| 2025-26 | Euroleague Grid 10 · PPG / P+A / 3PM | 9 | 35 | 3.9 |
| 2025-26 | Euroleague Grid 01 · P+A / 3PM / FT% | 9 | 33 | 3.7 |
| 2025-26 | Euroleague Grid 02 · 3PM / FT% / P+R | 9 | 29 | 3.2 |
| 2025-26 | Euroleague Grid 05 · 3P% / A/T / APG | 9 | 28 | 3.1 |
| 2025-26 | Euroleague Grid 03 · FT% / P+R / RPG | 9 | 25 | 2.8 |
| 2025-26 | Euroleague Grid 09 · APG / PPG / P+A | 9 | 25 | 2.8 |
| 2025-26 | Euroleague Grid 08 · A/T / APG / PPG | 9 | 17 | 1.9 |
| 2025-26 | Euroleague Grid 06 · A/T / APG / PPG | 9 | 14 | 1.6 |
| 2025-26 | Euroleague Grid 07 · APG / PPG / 3PM | 9 | 14 | 1.6 |