← Interview questions
Airbnb logo

Highly Rated Listings

Airbnb·easy·SQL

Identify high-quality listings in key cities. Find all listings in San Francisco and New York that have received at least 10 reviews and an average rating of 4.5 or higher. Return listing_id, name, city, the review count, and the average rating rounded to 2 decimal places, ordered by average rating descending.

Schema

listings
listing_idINTEGER
nameVARCHAR
cityVARCHAR
host_idINTEGER
reviews
review_idINTEGER
listing_idINTEGER
ratingDECIMAL
submitted_atDATE

Target output

Target output
listing_idnamecityreview_countaverage_rating
6Chelsea FlatNew York104.90
1Cosy Studio MissionSan Francisco104.70
4Brooklyn BrownstoneNew York104.50
Querylistings, reviews
Cmd+Enterto runLoading...
Output

Loading sample data...