Same car, many rows
Intermediateduplicates, HAVINGVehicle fuel economy (FuelEconomy.gov, model years 2010–2027)
A model often has several rows (engines, drives, gearboxes). For 2024, return make, model and the row count for models with 8 or more rows, largest first, then make and model A→Z.
Solution
SELECT make, model, COUNT(*) AS n
FROM vehicles
WHERE year = 2024
GROUP BY make, model
HAVING COUNT(*) >= 8
ORDER BY n DESC, make, model;Expected output:
Hint
GROUP BY make, model, then HAVING COUNT(*) >= 8.
Same question in Excel / Google Sheets
Pivot with make + model in Rows, count in Values, value filter ≥ 8.
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.