Question: Group all stays by the percent difference from rate was from the base price. For each grouping, list the percent difference (e.g., 15% off the
Group all stays by the percent difference from rate was from the base price. For each grouping, list the percent difference (e.g., 15% off the base price would show as -15) and the total number of days with that percent difference. Sort the results by the total number of days in ascending order.
Expected:
| percent | total_days |
| -15 | 162 |
| 25 | 208 |
| -10 | 458 |
| 15 | 510 |
| 0 | 833 |
Tables:
rooms:
| RoomCode | RoomName | Beds | bedType | maxOcc | basePrice | decor |
| AOB | Abscond or bolster | 2 | Queen | 4 | 175 | traditional |
| CAS | Convoke and sanguine | 2 | King | 4 | 175 | traditional |
| FNA | Frugal not apropos | 2 | King | 4 | 250 | traditional |
| HBB | Harbinger but bequest | 1 | Queen | 2 | 100 | modern |
| IBD | Immutable before decorum | 2 | Queen | 4 | 150 | rustic |
| IBS | Interim but salutary | 1 | King | 2 | 150 | traditional |
| MWC | Mendicant with cryptic | 2 | Double | 4 | 125 | modern |
| RND | Recluse and defiance | 1 | King | 2 | 150 | modern |
| RTE | Riddle to exculpate | 2 | Queen | 4 | 175 | rustic |
| TAA | Thrift and accolade | 1 | Double | 2 | 75 | modern |
reservations: (
| Field | Type | Null | Key | Default | Extra |
| CODE | int | NO | PRI | null | |
| Room | char(5) | YES | MUL | null | |
| CheckIn | date | YES | null | ||
| Checkout | date | YES | null | ||
| Rate | float | YES | null | ||
| LastName | varchar(15) | YES | null | ||
| FirstName | varchar(15) | YES | null | ||
| Adults | int | YES | null | ||
| Kids | int | YES | null |
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
