Vehicle Fleet Overview
What vehicles are registered on the mobility marketplace — make, model, year, colour, type, and status?
- Sorting
Challenge brief
Understand the request
Fleet Management needs a full inventory of all vehicles on the platform to review model year and service tier distribution.
List all vehicles with full details from the vehicles table.
Return
- make
- model
- year
- color
- vehicle_type
- status
Constraints
- Return every registered vehicle
- Order by vehicle type, make, then vehicle ID
Data you will use
Review the relevant tables before deciding how to join, filter, or aggregate them.
vehicles
makeVARCHAR(50)modelVARCHAR(50)yearINTEGERcolorVARCHAR(30)vehicle_typeVARCHAR(30)statusVARCHAR(20)
Hints, when you need them
Open one clue at a time so you still do the reasoning.
Hint 1
All data is in a single table: vehicles. No JOIN required. Just SELECT the columns and ORDER BY vehicle_type, make.
Hint 2
SELECT make, model, year, color, vehicle_type, status FROM vehicles. ORDER BY vehicle_type, make.
Hint 3
Project the requested vehicle attributes from the fleet table and apply all three ordering keys.
Verified SQL answer
Attempt the problem first, then compare structure and reasoning—not just syntax.
Reveal solution and explanation
SELECT make, model, year, color, vehicle_type, status FROM vehicles ORDER BY vehicle_type, make, vehicle_idWhy this works
Single-table query. ORDER BY vehicle_type groups the service tiers together (UberBlack, UberX, UberXL alphabetically), then make sorts within each type.
Success check
5 vehicles — 3 UberX, 1 UberXL, 1 UberBlack
Expected result
Use this output to verify values, aliases, ordering, and row count.
| make | model | year | color | vehicle_type | status |
|---|---|---|---|---|---|
| Tesla | Model 3 | 2023 | White | UberBlack | active |
| Ford | Fusion | 2021 | Red | UberX | active |
| Honda | Accord | 2023 | Black | UberX | active |
| Toyota | Camry | 2022 | Silver | UberX | active |
| Chevrolet | Suburban | 2022 | Blue | UberXL | active |
Learn the concepts behind this answer
Strengthen your understanding with these targeted learning topics:
Continue practicing
Explore related company challenges
Airbnb
Independent Airbnb-style marketplace, booking, listing, payment, review, and guest analytics SQL practice.
Amazon
Independent Amazon-style e-commerce, warehouse, inventory, and customer analytics SQL practice.
Google
Independent Google-style search, advertising, user-engagement, and video-product SQL practice.
Return to the complete interview preparation experience.