Describe how you would solve a regular SQL data manipulation problem involving subqueries with calculations, conditions, and concatenation.
Use the provided customer and booking data. Return customers with at least two completed bookings and more than 500 in completed booking value. Concatenate the customer's first and last names, handling a missing last name.
customer_name, city, completed_bookings, and total_completed_valuetotal_completed_value descending, then customer_name ascending| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| first_name | VARCHAR(80) | Customer first name |
| last_name | VARCHAR(80) | Customer last name |
| city | VARCHAR(80) | Customer home city |
| Column | Type | Description |
|---|---|---|
| booking_idPK | INT | Unique booking identifier |
| customer_id | INT | Customer who made the booking |
| status | VARCHAR(20) | Booking lifecycle status |
| amount | NUMERIC(10,2) | Booking value |