Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a report of all products sold, with the count of each product. But wherever there was only ONE unit of a product sold, leave
Write a report of all products sold, with the count of each product. But wherever there was only ONE unit of a product sold, leave it off the report. (Hint: you will need Group By and Having clause. You need only the order_detail table.)
mysql> select * from customer; + - + | Fname LName | AcctNum + Heidi Wonder 4552 Goodwin 3679 Toledo 1234 Frank James 5623 +----- 4 rows in set (0.00 sec) Sam Marge mysql> select * from orders; + | AcctNum | OrderNum OrderDate | StoreNum | Sales RepNum | 1 4552 3 2004-01-03 1 3679 6 2004-01-05 1 1234 7 2004-01-07 1 5623 8 2004-01-09 4552 9 2004-01-11 1 2670 3679 10 2004-01-13 1 1234 11 2004-01-15 1 1 5623 12 2004-01-17 1 4552 13 2004-01-19 1 3679 14 2004-01-21 1 1234 15 2004-01-23 5623 16 2004-01-25 1 4552 17 2004-01-27 1 +-- 13 rows in set (0.00 sec) 1 2 2 3 3 1 2 3 3 2 1 NULL mysql> select * from order_detail; +- | Ordernum | LineNum | ProdNum | Qty Color | UnitPrice 10 3 1 Bike28A 6 1 Bike28A 7 1 Bike28A 8 1 Bike28B 8 2 ridinggloves 1 9 1 Bike28B 10 1 1 Bike28B 1 11 1 Moped77 1 12 1 Bike31A 12 2 Helmet 13 1 Bike31A 14 1 | Bike28 15 1 | Bike28Cruiser 16 1 | Bike28Schwinn 1 | SchwinBike28Mountain +- 15 rows in set (0.00 sec) 1 Red 2 Blue NULL Green 3 Red 7 White 2 Blue 5 Green 1 1 Black 1 1 Red A 4 1 1 Blue 1 Orange 3 White 1 | Red 2 | Blue 300.00 259.00 525.00 455.00 60.00 255.00 199.00 955.00 525.00 75.00 455.00 255.00 199.00 955.00 855.00 Red 17 | mysql> select * from product; | ProdNum | ProdName ProdSupy | ColorGrp | Prodcost Bike28 standard29InBike Bike28A Trek 28InBike Bike28B Speedo 28InBike Bike28Cruiser Cruiser 28InBike Bike 28 Schwinn Schwinn 28InBike Bike31A Trek31InBike Helmet standardhelmet Moped77 Moped 7 7KPN ridinggloves standardRidingGloves SchwinBike28 Mountain Schwinn 28InMountainbike +- 10 rows in set (0.00 sec) Generic Trek Speedo AmBike Schwinn Trek AmManuf KPNEnterprise RidingSuppInc Schwinn 8colors 8colors 8colors 8colors 8colors 8colors RWB WhtBlk WhtBlk 8colors NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL mysql> select * from salesrep; | SalesRepNum | SalesFName | SalesLName | SalesSSN + | SalesHDate | SalesRate | SalesBonus | 1 Mike 2 Alice | 3 Mary +- 3 rows in set (0.00 sec) Smith Johnson Halvorson 222-33-4444 2001-01-01 999-11-8888 2004-05-01 333-00-9999 | 2004-06-01 | 25 27 | 22 4000.00 8000.00 NULLStep 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