Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to do solve the problems with the table data below? Please note: if the answer is a SELECT statement, print the statement and the

How to do solve the problems with the table data below?

Please note: if the answer is a SELECT statement, print the statement and the output; if the answer is an INSERT, UPDATE, or DETELE statement, print the statement and, the data before and after the statement is run.

1.Your supervisor wants to know the minimum qty*unitprice of any line items in the database; also the maximum qty*unitprice.

2. 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.)

3. Your supervisor wants a count of the different kinds of bikes sold. (Hint: use Distinct)

Table data:

image text in transcribedimage text in transcribed
mysql> select from customer +-------+- ---- | Ename LName | Acct Num +--- | Heidi | Wonder | 4552 | Sam | Goodwin 3679 | Marge | Toledo | 1234 | Frank | James | 5623 +-------+-- 4 rows in set (0.00 sec) mysql> select * from orders; +------- | AcctNum OrderNum Order Date | StoreNum Sales RepNum +-- ------ | 4552 3 | 2004-01-03 | 1 11 13679 6 2004-01-05 1 1 | 1234 7 2004-01-07 1 | 2 | 5623 8 | 2004-01-09 1 12 | 4552 9 2004-01-11 | 1 13 | 3679 10 | 2004-01-13 1 3 | 1234 11 | 2004-01-15 | 1 11 | 5623 12 | 2004-01-17 | 1 | 2 14552 13 | 2004-01-19 1 13 | 3679 14 | 2004-01-21 | 1 3 | 1234 15 | 2004-01-23 1 12 | 5623 16 | 2004-01-25 | 1 11 | 4552 17 | 2004-01-27 1 | NULL +-- 13 rows in set (0.00 sec) mysql> select * from order_detail; -+- | OrderNum LineNum ProdNum Qty Color | UnitPrice - 1 | 1 1 1 1 31 1 Bike28A 61 1 Bike28A 71 1 Bike28A 1 Bike28B 2 ridinggloves 91 1 | Bike28B 10 1 1 Bike28B 11 1 | Moped77 12 | 1 Bike31A 12 2 Helmet 13 | 1 Bike31A 14 1 1 Bike28 151 1 Bike28 Cruiser 16 1 Bike28 Schwinn 17 1 | SchwinBike28Mountain +- 15 rows in set (0.00 sec) 1 | Red 2 Blue NULL | Green 3 Red 7 | White 2 Blue 5 | Green 1 | Black 1 | Red 4 | Red 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 + 1 1 1 1 1 1 1 1 mysql> select * from product; | ProdNum | ProdName | ProdSupy | ColorGrp ProdCost +- | Bike28 | standard29InBike | Generic | 8 colors | NULL Bike28A | Trek28InBike | Trek | 8 colors NULL | Bike28B | Speedo 28 InBike | Speedo | 8colors 1 NULL Bike28Cruiser | Cruiser 28InBike | AmBike | 8colors NULL | Bike28 Schwinn | Schwinn29InBike | Schwinn | 8colors NULL | Bike31A | Trek31InBike | Trek | 8colors NULL | Helmet i standardhelmet | AmManuf | RWB 1 NULL Moped77 | Moped77KPN | KPNEnterprise | WhtBlk NULL | ridinggloves | standardRiding Gloves | RidingSuppInc | WhtBlk 1 NULL | SchwinBike2 BMountain | Schwinn28 InMountainBike | Schwinn | 8colors 1 NULL +----- ------ 10 rows in set (0.00 sec) mysql> select * from salesrep; +----------- ---- | Sales RepNum SalesFName | SalesLName SalesSSN | SalesHDate SalesRate | SalesBonus 1 | 2 13 | Mike | Alice | Mary | Smith | Johnson | Halvorson | 222-33-4444 | 999-11-8888 | 333-00-9999 2001-01-01 2004-05-01 2004-06-01 25 27 22 4000.00 8000.00 NULLI 3 rows in set (0.00 sec)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

0764549634, 9780764549632

More Books

Students also viewed these Databases questions

Question

8. Managers are not trained to be innovation leaders.

Answered: 1 week ago