Given a schema of property acquisitions and monthly maintenance costs, write a query to find the top 10% of properties with the highest maintenance-to-revenue ratio.
Use properties with a positive, non-null monthly revenue. Treat properties without maintenance records as having zero maintenance cost.
property_id, property_name, monthly_revenue, total_maintenance_cost, and maintenance_to_revenue_ratio.property_id ascending to break ties.| Column | Type | Description |
|---|---|---|
| property_idPK | INT | Unique property identifier |
| property_name | VARCHAR(100) | Property display name |
| Column | Type | Description |
|---|---|---|
| acquisition_idPK | INT | Unique acquisition record identifier |
| property_id | INT | References the acquired property |
| acquisition_date | DATE | Date the property was acquired |
| monthly_revenue | NUMERIC(12,2) | Expected monthly revenue for the property |
| Column | Type | Description |
|---|---|---|
| maintenance_idPK | INT | Unique maintenance record identifier |
| property_id | INT | Property associated with the maintenance cost |
| maintenance_month | DATE | First day of the maintenance month |
| maintenance_cost | NUMERIC(12,2) | Maintenance cost recorded for the month |