Write a query to find the year-over-year growth in home sales for each geographic market at Redfin.
Use calendar years represented in the sales data and include every geographic market for every year in that range. Treat markets or years with no sales as zero. Return a null growth percentage when there is no prior-year comparison or the prior year has zero sales.
market_name, sales_year, home_sales_count, and yoy_growth_pct.market_name, then sales_year ascending.| Column | Type | Description |
|---|---|---|
| market_idPK | INT | Unique geographic market identifier |
| market_name | VARCHAR(100) | Name of the geographic market |
| Column | Type | Description |
|---|---|---|
| home_sale_idPK | INT | Unique home sale identifier |
| market_id | INT | Geographic market associated with the sale |
| sale_date | DATE | Date the home sale closed |