Marriott International wants to monitor whether guests who completed a booking return in the following month. Write a PostgreSQL query that calculates monthly guest retention by the guest's booking channel in the cohort month.
booking_status = 'Completed'.Unknown, and sort by retention month and booking channel.A retained guest may return through any booking channel. The segment represents the channel used in the cohort month.
| Column | Type | Description |
|---|---|---|
| guest_idPK | INT | Unique guest identifier |
| guest_name | VARCHAR(100) | Guest full name |
| loyalty_tier | VARCHAR(30) | Marriott Bonvoy loyalty tier |
| Column | Type | Description |
|---|---|---|
| booking_idPK | INT | Unique booking identifier |
| guest_id | INT | Guest who made the booking |
| booked_at | TIMESTAMP | Timestamp when the booking was made |
| booking_channel | VARCHAR(40) | Booking source |
| booking_status | VARCHAR(20) | Booking lifecycle status |