SQL Taskbook Level 8.3
The tables are given:
| id | total | client_id | date |
|---|---|---|---|
| 1 | 700 | 5 | 2023-11-11 |
| 2 | 500 | 1 | 2023-01-12 |
| 3 | 340 | 1 | 2023-01-13 |
| 4 | 1999 | 4 | 2022-10-11 |
| 5 | 875 | 3 | 2023-05-25 |
| 6 | 201 | 2 | 2023-04-30 |
| 7 | 700 | 2 | 2022-12-25 |
| 8 | 821 | 3 | 2023-07-03 |
| 9 | 219 | 5 | 2023-11-11 |
| 10 | 329 | 1 | 2023-03-31 |
| 11 | 986 | 3 | 2023-02-28 |
| id | name |
|---|---|
| 1 | John |
| 2 | Lolita |
| 3 | Ann |
| 4 | Alex |
| 5 | Matthew |
Solve the following tasks for them:
Find the customer who has made the maximum number of orders and print the total amount of all his orders, as well as his name and the date of his first order.
Modify the previous problem so that you also find the customer with the earliest date of their first order and the latest date of their last order, and print them.