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_idINTEGERcityVARCHAR(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_idWhy 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_id | city | price_per_night |
|---|---|---|
| 1 | New York | 150 |
| 2 | Bangalore | 60 |
| 3 | London | 180 |
| 4 | Toronto | 140 |
| 5 | San Francisco | 200 |
| 6 | Paris | 160 |
| 7 | Lisbon | 150 |
Learn the concepts behind this answer
Strengthen your understanding with these targeted learning topics:
Continue practicing
Explore related company challenges
Uber
Independent Uber-style mobility marketplace SQL practice covering trips, drivers, riders, pricing, payments, and promotions.
Amazon
Independent Amazon-style e-commerce, warehouse, inventory, and customer analytics SQL practice.
Meta
Independent Meta-style social-product, engagement, content, community, messaging, and advertising SQL practice.
Return to the complete interview preparation experience.