Automatic or manual?
Intermediatetext parsingVehicle fuel economy (FuelEconomy.gov, model years 2010–2027)
The trany column mixes formats like Automatic (S8) and Manual 6-spd. Return each of Automatic / Manual / Other with its count, for model year 2024 only.
Solution
SELECT CASE
WHEN trany LIKE 'Auto%' THEN 'Automatic'
WHEN trany LIKE 'Manual%' THEN 'Manual'
ELSE 'Other'
END AS gearbox,
COUNT(*) AS n
FROM vehicles
WHERE year = 2024
GROUP BY gearbox;Expected output:
Hint
LIKE 'Auto%' and LIKE 'Manual%' are enough here.
Same question in Excel / Google Sheets
=IF(LEFT(G2,4)="Auto","Automatic",IF(LEFT(G2,6)="Manual","Manual","Other")) + pivot filtered to 2024.
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.