Question paper (build 07.05.20.19)
1
1
Nguyễn Thị Mai
2
1902000.00
23
7
Bùi Thị Ngọc
0
0.00
8
Nguyễn Hoàng Nam
1
573000.00
4
14
Bùi Văn Lâm
0
0.00
5
15
Nguyễn Thị Hồng
3
1576000.00
6
21
Bùi Thị Nhung
3
2156000.00
7
22
Nguyễn Văn Tín
1
900000.00
8
28
Bùi Ngọc Linh
1
570000.00
9
29
Nguyễn Văn Khánh
1
405000.00
10
35
Bùi Thị Trang
11
36
Nguyễn Hoài Phương 0
12
42
Bùi Thanh Bình
206
2
1155000.00
0.00
6
1947000.00
13
43
Nguyễn Lan Hương
0
0.00
14
49
Bùi Thị Thu Hà
3
15 50
Nguyễn Quốc Đạt
1
1215000.00
800000.00
Picture 5.1
Question 6:
Write an SQL query to list all customers whose total spending on completed orders in 2025
is below the average total spending in 2025 of all customers, including those who made no
orders. For each customer, display: CustomerID, FullName, TotalAmount (the total value of
all completed orders in 2025 (use 0 for customers with no orders)). Ensure calculating the
average total spending based on all customers, including those with 0 spending. Sort the
output by TotalAmount in descending order, then by CustomerID in ascending order for
customers having the same TotalAmount.