Airbnb-style Company ChallengeBeginnerVerified answerSQLite live

Listing Catalog

Return listing_id, city, and price_per_night for all listings, ordered by listing_id.

  • Sorting

Challenge brief

Understand the request

Supply Team The supply team needs a current snapshot of every active listing with its location and nightly rate.

List all properties with their city and nightly price.

Return

  • listing_id
  • city
  • price_per_night

Constraints

  • Include every listing
  • Order by listing ID

Data you will use

Review the relevant tables before deciding how to join, filter, or aggregate them.

listings

  • listing_idINTEGER
  • cityVARCHAR(50)
  • price_per_nightINTEGER

Hints, when you need them

Open one clue at a time so you still do the reasoning.

Hint 1

The catalog table contains the requested listing attributes.

Hint 2

No activity table is needed for a complete catalog.

Hint 3

Use the listing key for stable order.

Verified SQL answer

Attempt the problem first, then compare structure and reasoning—not just syntax.

Reveal solution and explanation
SELECT listing_id, city, price_per_night FROM listings ORDER BY listing_id

Why this works

All three columns come from the listings table. ORDER BY listing_id gives a stable, reproducible list.

Success check

Returns one row per listing in stable listing order

Expected result

Use this output to verify values, aliases, ordering, and row count.

listing_idcityprice_per_night
1New York150
2Bangalore60
3London180
4Toronto140
5San Francisco200
6Paris160
7Lisbon150

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.