Write a SQL query to find the top 10% of properties by yield in each state, given a table of property valuations and monthly rental income. Calculate yield using the latest valuation and the annualized average monthly rental income. Exclude properties without a valid valuation or rental income.
state, property_id, annual_yield_percent, valuation_amount, and avg_monthly_rental_income.state, descending annual_yield_percent, then property_id.| Column | Type | Description |
|---|---|---|
| valuation_idPK | INT | Unique valuation record identifier |
| property_id | INT | Property identifier |
| state | VARCHAR(2) | Two-letter property state code |
| valuation_amount | DECIMAL(12,2) | Property valuation amount |
| valuation_date | DATE | Date of valuation |
| Column | Type | Description |
|---|---|---|
| rental_income_idPK | INT | Unique rental income record identifier |
| property_id | INT | Property identifier |
| income_month | DATE | First day of the income month |
| monthly_rental_income | DECIMAL(10,2) | Rental income recorded for the month |