Zoom
Question 6:
ccare on
Write an SQL query to list all menu items whose total sales amount in completed orders in
2023 is below the average total sales amount in 2023 of all menu items, including those with
5 of 5
Paper No: 5
no sales in 2023. For each menu item, display: ItemID, ItemName, Category, TotalAmount
(the total revenue generated from completed orders in 2023 (use 0 for items that were not
sold in 2023). Ensure to calculate the average total sales across all items (including those
with zero revenue). Sort the result by TotalAmount in ascending order, and then by ItemID in
ascending order for items having the same TotalAmount
TotalAmount
ItemID
ItemName
1
6
Cơm tấm sườn bì chả
Category
Món chính
0.00
2
30
Bánh mì pate trứng
Món ăn nhẹ
40000.00
3
16
Trà đã
Thức uống
55000.00
4
5
6
7
8
9
10
FOTO22
11 24
12
13
14
15
16 19
17 20
18 23
19
20
21
87722222222222221-S
Coca-Cola
Thức uống
60000.00
Nước suối
Thức uống
70000.00
Mì xào hải sản
Món chính
80000.00
Trà sữa trân châu
Thức uống
80000.00
Cafe den dá
Thức uống
125000.00
Bánh chuối nướng
Cafe sữa đá
Chè thập cẩm
29
Chè khúc bạch
25
Bánh flan
26
Kem dua
Tráng miệng 128000.00
Thức uống
Tráng miệng 150000.00
Tráng miệng 165000.00
Tráng miệng 200000.00
Tráng miệng 210000.00
140000.00
15
Súp nấm hải sản
Món khai vị
225000.00
Sinh tố bơ
Thức uống
245000.00
Sinh tố xoài
Thức uống
245000.00
Nước chanh
Thức uống
280000.00
Nem rán Hà Nội
Món khai vị
300000.00
14
Súp ngô gà
Món khai vị
320000.00
Phở bò tái
Món chính
325000.00
13
Chả giò hải sản
Món khai vị
420000.00
Picture 6.1
Question 7:
Write an SQL query to analyze customer spending trends between 2023 and 2024 based on
completed orders. For each customer who placed completed orders in both 2023 and 2024,
calculate and display:
- CustomariD
+ 54%
Close