Need help with mySQL below I attached screen shots of the tables data for answer
ID: 3893279 • Letter: N
Question
Need help with mySQL below I attached screen shots of the tables data for answering the questions.
1.) What are our top selling items? Please show me the item name, item price, and number sold, but limit it to only just the top ten (10) and list them in order of number sold and item price.
Your results should match this exactly: | item name l price | qty I | Salted Butter | Pepper Pasta | Strawberry-Rhubarb Crisjp | Bread with Compote Butter | Fruit Salad Deluxe with Fruit |3.881 3718 I | Sunset Appetizer | Lettuce Wraps | Crackers with Cheese | Nescafe Espresso | Bar Peanuts | 1.83 1 3743 I 1 1.63 3742 I | 1.98 3739 I 6.661 3719 I 1 3.34 3717 I 1 8.35 3717 I 3.30 3713 I 1 9.96 3675 I 1 2.75 3671 I 10 rows in setExplanation / Answer
If you have any doubts, please give me comment...
1)
SELECT *
FROM (SELECT item_name, price, SUM(qty) AS qty
FROM Menu M, order_detail O
WHERE M.menuid=O.menuid
GROUP BY O.menuid, price) AS T
ORDER BY qty, price
LIMIT 10;
Q3)
SELECT item_name, price, qty, price*qty AS total_sales
FROM (SELECT item_name, price, SUM(qty) AS qty
FROM Menu M, order_detail O
WHERE M.menuid=O.menuid
GROUP BY O.menuid, price) AS T
ORDER BY qty, price
LIMIT 10;
Q4)
SELECT *
FROM (SELECT DAYNAME(order_date) AS day, SUM(qty) AS qty
FROM Menu M, order_detail O, order_main OM
WHERE M.menuid=O.menuid AND O.orderid = OM.orderid
GROUP BY DAYNAME(order_date)) AS T
ORDER BY qty;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.