Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: The most expensive transmission + engine size combinations | Practicing
SQL Basics

book
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

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?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 6. Kapitel 7

Query ResultQuery Result
No query executed yet...

Spørg AI

expand
ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

We use cookies to make your experience better!
some-alt