Write a query to find the average lease duration and total revenue generated per property category, filtering out properties with less than a specific occupancy rate at Jones Lang LaSalle.
Assume the occupancy threshold is 80%. Use the properties and leases tables, calculate lease duration in days, and include qualifying categories without leases.
property_category, average_lease_duration_days, and total_revenuetotal_revenue descending, then property_category ascending| Column | Type | Description |
|---|---|---|
| property_idPK | INT | Unique property identifier |
| property_category | VARCHAR(50) | Property category |
| occupancy_rate | DECIMAL(5,4) | Occupied share of the property, stored between 0 and 1 |
| Column | Type | Description |
|---|---|---|
| lease_idPK | INT | Unique lease identifier |
| property_id | INT | Referenced property identifier |
| lease_start | DATE | Lease start date |
| lease_end | DATE | Lease end date |
| revenue | DECIMAL(14,2) | Revenue generated by the lease |