Recap - Scooter Shop
Part of the Fundamentals section of Coddy's SQL journey — lesson 41 of 72.
Challenge
EasyAvailable tables and columns:
<strong>scooters</strong>:<strong>model</strong>,<strong>brand</strong>,<strong>has_lights</strong>,<strong>price</strong>
As the manager of a scooter shop, you have noticed that many scooters are not original, meaning they are missing a model name. Furthermore, bad scooters typically do not have lights.
Your task involves two steps:
- First, Add to all scooter prices in the shop the overall average price.
- Then, Calculate the average price for each
brand, considering only good and original scooters (i.e., scooters with a model name and lights).
The result should include the brand and the average price - avg_price. Sort the results by the average price in ascending order.
Try it yourself
All lessons in Fundamentals
4More Keywords
The IN keywordThe BETWEEN keywordThe LIKE keywordThe AS keywordRecap - Cellphone Models2Conditions
Conditions BasicsThe AND keywordThe OR keywordThe NOT keywordMultiple Conditions CombinedParenthesisBooleans5Arithmetic Operations
Mathematical OperatorsMathematical ColumnsThe Modulo OperationThe ROUND() Function3Specific Return Format
Null valuesSort Results Part 1Sort Results Part 2Recap - Cyber Security FirmLimit number of recordsRecap - Vehicle Factory6Intro Challenges
Recap - Parliamentary ElectionRecap - Police Criminal ArrestRecap - Bar Beverage ContainerRecap - Engineer new columns