Question
MYSQL database : 1) Table OrderItems contains the items within each order. Write a SQL statement that return a list of order numbers (order_num) and
MYSQL database :
1) Table OrderItems contains the items within each order. Write a SQL statement that return a list of order numbers (order_num) and the total quantity of items for each order.
2) Modify number 1 but it only returns orders of at least 100 items, and sort the results from largest order to smallest.
table orderitems:
column are :
order_num, order_item, prod_id, quantity, item_price
'20005', '1', 'BR01', '100', '5.49' '20005', '2', 'BR03', '100', '10.99' '20006', '1', 'BR01', '20', '5.99' '20006', '2', 'BR02', '10', '8.99' '20006', '3', 'BR03', '10', '11.99' '20007', '1', 'BR03', '50', '11.49' '20007', '2', 'BNBG01', '100', '2.99' '20007', '3', 'BNBG02', '100', '2.99' '20007', '4', 'BNBG03', '100', '2.99' '20007', '5', 'RGAN01', '50', '4.49' '20008', '1', 'RGAN01', '5', '4.99' '20008', '2', 'BR03', '5', '11.99' '20008', '3', 'BNBG01', '10', '3.49' '20008', '4', 'BNBG02', '10', '3.49' '20008', '5', 'BNBG03', '10', '3.49' '20009', '1', 'BNBG01', '250', '2.49' '20009', '2', 'BNBG02', '250', '2.49' '20009', '3', 'BNBG03', '250', '2.49'
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started