Write a SQL query to find days when occupancy was high but Guest Satisfaction Scores fell below the property average.
Treat occupancy of 90% or higher as high. Calculate each property's average from its non-null daily Guest Satisfaction Scores, and calculate one daily score per property and date.
property_id, property_name, occupancy_date, occupancy_rate, daily_gss, and property_avg_gssproperty_id, then occupancy_date ascending| Column | Type | Description |
|---|---|---|
| property_idPK | INT | Unique property identifier |
| property_name | VARCHAR(150) | Property display name |
| Column | Type | Description |
|---|---|---|
| occupancy_idPK | INT | Unique occupancy record identifier |
| property_id | INT | Referenced property |
| occupancy_date | DATE | Date of the occupancy measurement |
| occupancy_rate | DECIMAL(5,4) | Occupied rooms divided by available rooms |
| Column | Type | Description |
|---|---|---|
| feedback_idPK | INT | Unique feedback record identifier |
| property_id | INT | Referenced property |
| feedback_date | DATE | Date associated with the feedback |
| gss_score | DECIMAL(4,2) | Guest Satisfaction Score from 0 to 10 |