MEDIUMVerified Real Interview• Marketplace Data Analyst

Listing Price vs Neighborhood Average

Airbnb wants to identify listings that are priced significantly higher than other homes in the same neighborhood.

Write a query to calculate the price difference between each listing's price and the average price of listings in that same neighborhood. Return:

  • listing_id
  • neighborhood
  • price
  • price_diff_vs_neighborhood (rounded to 2 decimal places)

Order results by price_diff_vs_neighborhood descending.

Table:

  • listings (listing_id INT, neighborhood VARCHAR, price DECIMAL)

Execution Sandbox:

Your query executes inside an isolated in-memory PostgreSQL engine (PGlite WebAssembly). You have full access to standard PostgreSQL aggregations, window functions, and CTEs.

Standard SQL (ANSI)|Ln 1, Col 1
⌘↵ Run Query
Ready to execute. Press Run (⌘+Enter)
Write your query and click “Run” or press ⌘+Enter to inspect output.