Can you write a SQL query to extract specific user data from a database for Klook?
Use the provided users and bookings tables. Return every user, including users without completed bookings. Completed bookings are identified by status = 'completed'.
user_id, full_name, country, completed_booking_count, completed_spend, latest_completed_booking, and booking_status.booking_status to booked when the user has at least one completed booking, otherwise never_booked.completed_spend descending, then user_id ascending.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique user identifier |
| full_name | VARCHAR(100) | User's full name |
| country | VARCHAR(60) | User's country of residence |
| Column | Type | Description |
|---|---|---|
| booking_idPK | INT | Unique booking identifier |
| user_id | INT | User who made the booking |
| activity_name | VARCHAR(150) | Booked Klook activity |
| status | VARCHAR(20) | Booking state |
| booking_date | DATE | Date the booking was created |
| total_amount | NUMERIC(10,2) | Booking amount in the reporting currency |