Challenge: The most expensive transmission + engine size combinations
Opgave
Swipe to start coding
From the audi_cars
table calculate the average price
for each combination of transmission
and enginesize
. Round average price to 0 decimals (convert to integer). Filter to only those groups having at least 10 cars within. Sort the results in descending order by average price and extract only the first 5 rows.
Løsning
9
1
2
3
4
5
6
SELECT transmission, enginesize, ROUND(AVG(price), 0)
FROM audi_cars
GROUP BY transmission, enginesize
HAVING COUNT(*) >= 10
ORDER BY AVG(price) DESC
LIMIT 5
Var alt klart?
Tak for dine kommentarer!
Sektion 6. Kapitel 7
9
1
No query executed yet... |
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat