Topics / 🗄️ SQL, pandas & Data Analysis / 🗄️ Level 14: SQL Fundamentals

SQL exercise · about 5 minutes · free

GROUP BY the Map

Aggregation turns a million rows into one insight.

GROUP BY makes one row per group. Use SUM, COUNT, AVG on each group.

SELECT map, COUNT(*) FROM matches GROUP BY map
Table. matches (12 rows): map, kills; Dust | 5; Ice | 9; Dust | 14; Ice | 11; Lava | 7; … | …. Operation: GROUP BY map, SUM(kills). Result result: map, total_kills; Dust | 72; Ice | 56; Lava | 21matches (12 rows)mapkillsDust5Ice9Dust14Ice11Lava7……resultmaptotal_killsDust72Ice56Lava21GROUP BY map, SUM(kills)
Your quest: For each map, show the map and the total kills as total_kills.
Starter code
-- total kills per map
-- Run this first to see the matches table, then change it to answer the task.
SELECT *
FROM matches
LIMIT 5;

Try it in your browser → Free. Sign in with Google to run it. Your code runs on your device.

In this level you'll learn:
More in Level 14: SQL Fundamentals

Share on LinkedIn