SQL Taskbook Level 8.2
The 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 customers whose order amount is maximum and exceeds the average order amount of all customers. Print their names and order amount.
Find customers with the highest order totals, but who ordered in no more than two different months. Display their names and order totals.