Uber-style Company ChallengeBeginnerVerified answerSQLite live

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)
  • yearINTEGER
  • colorVARCHAR(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_id

Why 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.

makemodelyearcolorvehicle_typestatus
TeslaModel 32023WhiteUberBlackactive
FordFusion2021RedUberXactive
HondaAccord2023BlackUberXactive
ToyotaCamry2022SilverUberXactive
ChevroletSuburban2022BlueUberXLactive

Learn the concepts behind this answer

Strengthen your understanding with these targeted learning topics:

Continue practicing

SQL Interview Practice

Return to the complete interview preparation experience.