Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN LINUX IN SQL mysql> select * from customer; +-------+---------+---------+ | fname | lname | acctnum | +-------+---------+---------+ | Heidi | Wonder | 4552 |

IN LINUX IN SQL

mysql> select * from customer; +-------+---------+---------+ | fname | lname | acctnum | +-------+---------+---------+ | 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 | orderdate | storenum | salesrepnum | +---------+----------+------------+----------+-------------+ | 4552 | 3 | 2004-01-03 | 1 | 1 | | 3679 | 6 | 2004-01-05 | 1 | 1 | | 1234 | 7 | 2004-01-07 | 1 | 2 | | 5623 | 8 | 2004-01-09 | 1 | 2 | | 4552 | 9 | 2004-01-11 | 1 | 3 | | 3679 | 10 | 2004-01-13 | 1 | 3 | | 1234 | 11 | 2004-01-15 | 1 | 1 | | 5623 | 12 | 2004-01-17 | 1 | 2 | | 4552 | 13 | 2004-01-19 | 1 | 3 | | 3679 | 14 | 2004-01-21 | 1 | 3 | | 1234 | 15 | 2004-01-23 | 1 | 2 | | 5623 | 16 | 2004-01-25 | 1 | 1 | | 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 | +----------+---------+----------------------+------+--------+-----------+ | 3 | 1 | Bike28A | 1 | Red | 300.00 | | 6 | 1 | Bike28A | 2 | Blue | 259.00 | | 7 | 1 | Bike28A | NULL | Green | 525.00 | | 8 | 1 | Bike28B | 3 | Red | 455.00 | | 8 | 2 | ridinggloves | 7 | White | 60.00 | | 9 | 1 | Bike28B | 2 | Blue | 255.00 | | 10 | 1 | Bike28B | 5 | Green | 199.00 | | 11 | 1 | Moped77 | 1 | Black | 955.00 | | 12 | 1 | Bike31A | 1 | Red | 525.00 | | 12 | 2 | Helmet | 4 | Red | 75.00 | | 13 | 1 | Bike31A | 1 | Blue | 455.00 | | 14 | 1 | Bike28 | 1 | Orange | 255.00 | | 15 | 1 | Bike28Cruiser | 3 | White | 199.00 | | 16 | 1 | Bike28Schwinn | 1 | Red | 955.00 | | 17 | 1 | SchwinBike28Mountain | 2 | Blue | 855.00 | +----------+---------+----------------------+------+--------+-----------+ 15 rows in set (0.00 sec)

mysql> select * from product; +----------------------+-------------------------+---------------+----------+----------+ | prodnum | prodname | prodsupy | colorgrp | prodcost | +----------------------+-------------------------+---------------+----------+----------+ | Bike28 | standard29InBike | Generic | 8colors | NULL | | Bike28A | Trek28InBike | Trek | 8colors | NULL | | Bike28B | Speedo28InBike | Speedo | 8colors | NULL | | Bike28Cruiser | Cruiser28InBike | AmBike | 8colors | NULL | | Bike28Schwinn | Schwinn28InBike | Schwinn | 8colors | NULL | | Bike31A | Trek31InBike | Trek | 8colors | NULL | | Helmet | standardhelmet | AmManuf | RWB | NULL | | Moped77 | Moped77KPN | KPNEnterprise | WhtBlk | NULL | | ridinggloves | standardRidingGloves | RidingSuppInc | WhtBlk | NULL | | SchwinBike28Mountain | Schwinn28InMountainBike | Schwinn | 8colors | NULL | +----------------------+-------------------------+---------------+----------+----------+ 10 rows in set (0.00 sec)

mysql> select * from salesrep; +-------------+------------+------------+-------------+------------+------------+------------+ | salesrepnum | salesfname | saleslname | salesssn | saleshdate | saleshrate | salesbonus | +-------------+------------+------------+-------------+------------+------------+------------+ | 1 | Mike | Smith | 222-33-4444 | 2001-01-01 | 25 | 4000.00 | | 2 | Alice | Johnson | 999-11-8888 | 2004-05-01 | 27 | 8000.00 | | 3 | Mary | Halvorson | 333-00-9999 | 2004-06-01 | 22 | NULL | +-------------+------------+------------+-------------+------------+------------+------------+ 3 rows in set (0.00 sec)

1) Write a report of all orders that have no salesrep recorded.

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

3) Create a report of all line items that have

-Bike28A

-Helmet

-Bike28Schwinn

Your supervisoror likes good SQL statements, so use as simple SQL as possible. (Hint: use the IN keyword)

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

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions