Points to Wallet in Two Batches
HardDescription
Customers can turn loyalty points into wallet money: every full 500 points become ₹50 in their wallet, and the points that don't make a full 500 stay. A customer with 1200 points would get ₹100 and keep 200 points.
Finance runs the conversion in one transaction, in two batches:
- convert the points of the customers with 2000 or more points
- set a savepoint
- convert the points of the customers with 1000 to 1999 points
Finance then rejects the second batch: undo only that batch, and commit.
Show customer_id, loyalty_points and balance of customers 1, 7, 8, 10, 16, 21 and 25.
End your query with ORDER BY customer_id.
Tables
| customers |
|---|
| customer_id (PK) |
| full_name |
| loyalty_points |
| accounts |
|---|
| account_id (PK) |
| customer_id (FK) |
| balance |