Events per type
BeginnerGROUP BYEarthquakes (USGS, Oct 2026)
For each type, return the type and how many rows have it. Sort by the count, largest first.
Solution
SELECT type, COUNT(*) AS n
FROM quakes
GROUP BY type
ORDER BY n DESC;Expected output:
Hint
GROUP BY type, COUNT(*), ORDER BY the count.
Same question in Excel / Google Sheets
Insert → PivotTable: type in Rows, Count of id in Values.
Download the CSV from the datasets page. Column letters assume the CSV opens with its header in row 1.
Tip: Ctrl+Enter (⌘+Enter on Mac) checks your answer. Everything runs in your browser; nothing you type is sent anywhere.