Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

SQL and Preprocessing Practice

MediumSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is SQL and Preprocessing Practice. Start with the requirements and the two tables on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Describe how you would approach a SQL and data preprocessing problem to produce a reliable dataset for analysis at Zillow.

Use the provided Zillow listing and event data to return valid listings as of January 31, 2025. Exclude records with missing or invalid core attributes, select the latest event available by the cutoff, and retain listings whose latest status is ACTIVE or PENDING.

Output

  1. One row per qualifying listing with listing_id, city, state, list_price, bedrooms, latest_status, latest_event_at, and days_on_market.
  2. Sort by city ascending, then listing_id ascending.

Schema

listings
ColumnTypeDescription
listing_idPKINTUnique Zillow listing identifier
cityVARCHAR(100)Listing city, potentially blank or padded
stateCHAR(2)Two-letter state code
list_priceDECIMAL(12,2)Current listing price
bedroomsINTNumber of bedrooms
listed_atDATEDate the listing entered the market
listing_events
ColumnTypeDescription
event_idPKINTUnique listing event identifier
listing_idINTReferenced listing identifier
event_typeVARCHAR(20)Listing status event
event_atTIMESTAMPTime the status event occurred
ingested_atTIMESTAMPTime the event was loaded into the warehouse
Tableslistingslisting_events
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results