SQL Taskbook Level 7.10 of the SQL task book
The following tables are given:
| id | customer_id | order_date | total_amount |
|---|---|---|---|
| 1 | 2 | 2023-11-11 | 7500 |
| 2 | 1 | 2023-09-30 | 9000 |
| 3 | 2 | 2023-09-09 | 3200 |
| 4 | 1 | 2023-09-12 | 6700 |
| 5 | 2 | 2023-09-27 | 5500 |
| 6 | 3 | 2023-10-06 | 8200 |
| 7 | 4 | 2023-10-10 | 7300 |
| 8 | 5 | 2023-11-05 | 1200 |
| 9 | 4 | 2023-11-10 | 3600 |
| 10 | 1 | 2023-10-11 | 4500 |
| id | name |
|---|---|
| 1 | John |
| 2 | Andrew |
| 3 | Kevin |
| 4 | Mark |
| 5 | Eric |
Solve the following tasks for them:
Find the customers with the highest order amount and display the date of their last order for each of them.
Modify the previous task so that in addition to the last order date for customers with the highest order amount, you also display the total amount of their orders.