You’re working on the analytics team at a two-sided travel marketplace (similar to Airbnb) processing millions of booking requests per month. Host responsiveness is a core driver of conversion and revenue, and the operations team has set an SLA to keep the decline rate below 8%. They want a reliable metric that matches how product logs booking decisions.
Booking requests are created when a guest requests a stay. A request can later be accepted or declined by the host. Some requests may still be pending (no decision yet), and some may be canceled by the guest before a host responds. For this question, you will compute acceptance vs. decline percentages among only the requests that received a host decision.
Write a SQL query to compute the percentage of booking requests that were accepted vs. declined.
status IN ('accepted', 'declined').statusrequest_countpct_of_decided_requests (as a percentage from 0 to 100, rounded to 2 decimals)booking_requests| Column | Type | Description |
|---|---|---|
| request_id | BIGINT | Unique booking request identifier |
| guest_id | BIGINT | Guest who initiated the request |
| host_id | BIGINT | Host receiving the request |
| listing_id | BIGINT | Listing being requested |
| requested_at | TIMESTAMP | When the request was created |
| status | VARCHAR(20) | Current state: pending, accepted, declined, canceled_by_guest |
| decided_at | TIMESTAMP | When host made a decision (NULL if not decided) |
booking_requests| request_id | guest_id | host_id | listing_id | requested_at | status | decided_at |
|---|---|---|---|---|---|---|
| 9001 | 101 | 501 | 3001 | 2025-01-02 10:15:00 | accepted | 2025-01-02 12:05:00 |
| 9002 | 102 | 502 | 3002 | 2025-01-02 11:20:00 | declined | 2025-01-02 11:55:00 |
| 9003 | 103 | 501 | 3001 | 2025-01-03 09:00:00 | pending | NULL |
| 9004 | 104 | 503 | 3003 | 2025-01-03 14:10:00 | accepted | 2025-01-03 16:45:00 |
| 9005 | 105 | 504 | 3004 | 2025-01-04 08:30:00 | canceled_by_guest | NULL |
| status | request_count | pct_of_decided_requests |
|---|---|---|
| accepted | 2 | 66.67 |
| declined | 1 | 33.33 |