Question: Guaranteed upvote it done correctly : ) Standard Hardware Query Assignment Store both query and output in one script file. Use schema for your section
Guaranteed upvote it done correctly :
Standard Hardware Query Assignment
Store both query and output in one script file. Use schema for your section only. It would be from Section depending on which section you are in for all queries. When you have more than rows, show the first and the last rows with a comment in the middle indicating how many you have removed.
List all the data in all tables. Submit query only. Do NOT submit output.
List the customer number and name of customers who live in BRAMPTON descending name order
List the name and number of customers who have placed orders but who do not have a sales rep number ascending name order
List the average unit price of all appliances on file.
How many sports items are on file?
What is the total value of appliances that are on hand?
What is the average order price of sports items sold between January and November inclusive
What is the minimum and maximum unit price of the parts? Change the column headings.
What is the part number and description of the parts with that maximum price? Do not use a constant.
List the name and full address of customers who have never placed an order?
List all parts for which the part description starts with an A C or Spartno desc, price
List the same set of parts as # but add orderno orderdate if they were ordered.
Print a list of all the sales reps that represent anyone with Sh in their name. Do not print the same sales rep more than once.
What is the total amount of each order placed by customers living in Brampton?
What is the price of the cheapest part in each part class?
Determine the customer number, name and address of customers living in Brampton who have purchased $ or more of a part. Include the total amount of each part in the output. Ascending total amount order
After queries have been debugged, they should be run just prior to submission in order to have the most current data.
This is the code for it:
SELECT FROM customer;
SELECT FROM salesrep;
SELECT FROM part;
SELECT FROM salesorder;
SELECT FROM orderprod;
SELECT FROM invoice;
SELECT FROM invprod;
SELECT custno, custname
FROM customer
WHERE custcity 'BRAMPTON'
ORDER BY custname DESC;
SELECT ccustname, ccustno
FROM customer c
LEFT JOIN salesorder so ON ccustno socustno
WHERE csrepno IS NULL
ORDER BY ccustname ASC;
SELECT AVGunitprice AS avgunitprice
FROM part
WHERE partclass AP;
SELECT COUNT AS numsportitems
FROM part
WHERE partclass SP;
SELECT SUMonhand unitprice AS totalappliancevalue
FROM part
WHERE partclass AP;
SELECT AVGoporderprice AS avgsportorderprice
FROM orderprod op
INNER JOIN salesorder so ON oporderno soorderno
WHERE oppartno IN SELECT partno FROM part WHERE partclass SP
AND soorderdate BETWEEN AND ;
SELECT MINunitprice AS minprice, MAXunitprice AS maxprice
FROM part;
SELECT partno, partdesc
FROM part
WHERE unitprice SELECT MAXunitprice FROM part;
SELECT custname, CONCATcuststreet custcity, custprov, custpcode AS fulladdress
FROM customer c
LEFT JOIN salesorder so ON ccustno socustno
WHERE soorderno IS NULL;
SELECT partno, partdesc, unitprice
FROM part
WHERE partdesc LIKE A OR partdesc LIKE C OR partdesc LIKE S;
SELECT ppartno, ppartdesc, punitprice, oporderno, oporderdate
FROM part p
LEFT JOIN orderprod op ON ppartno oppartno
LEFT JOIN salesorder so ON oporderno soorderno
WHERE ppartdesc LIKE A OR ppartdesc LIKE C OR ppartdesc LIKE S;
SELECT DISTINCT srepno, srepname
FROM salesrep
WHERE srepname LIKE Sh;
SELECT soorderno, SUMoporderqty oporderprice AS totalorderprice
FROM salesorder so
INNER JOIN orderprod op ON soorderno oporderno
INNER JOIN customer c ON socustno ccustno
WHERE ccustcity 'BRAMPTON'
GROUP BY soorderno;
SELECT partclass, MINunitprice AS cheapestprice
FROM part
GROUP BY partclass;
SELECT ccustno, ccustname, CONCATccuststreet, ccustcity, ccustprov, ccustpcode AS fulladdress, SUMoporderqty oporderprice AS totalamount
FROM customer c
JOIN salesorder so ON ccustno socustno
JOIN orderprod op ON oporderno oporderno
JOIN part p ON oppartno ppartno
WHERE ccustcity 'BRAMPTON'
GROUP BY ccustno, ccustname, fulladdress
HAVING SUMoporderqty oporderprice
ORDER BY totalamount ASC;
What I want you to do is to explain the codes each part get the SQL and take a screenshot to show the outputs for each part for this assignment, thanks :)
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
