Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write SQL statements to display the data shown in the given tables for each corresponding question Find each order for a part that is larger
Write SQL statements to display the data shown in the given tables for each corresponding question Find each order for a part that is larger or equal to the average order for that part. Display, in an ascending order by part number, the part number, part name, quantity and the average quantity on order for that part. pNo qty AVE P1 300 233.3333 P1 300 233.3333 P2 400 250.0000 P3 400 333.3333 P3 400 333.3333 P4 200 200.0000 P4 200 200.0000 P5 100 100.0000 2 As above, but also display the part name. pNo qty AVE P1 300 233.3333 Nut P1 300 233.3333 Nut P2 400 250.0000 Bolt P3 400 333.3333 Screw P3 400 333.3333 Screw P4 200 200.0000 Screw P4 200 200.0000 Screw P5 100 100.0000 Cam pName Display information about parts that have their weights greater than the average weight of all parts. pNo pName P2 Bolt P3 Screw Find supplier numbers of suppliers located in London who supply screws (i.c., such that the part name is 'screw or bolts. The constraint is that you may not use any join or product, but use a subquery(ies). (Hint: Use subquery(ies).) SNo S1 S2 S4 For cach part find the total, minimum, average, and maximum quantity of individual orders (each order is a tuple in p) and the total number of orders. Display the part number and for that part: the number of orders, total, minimum, average, maximum quantity of individual orders for that part and also the average quantity on order over all parts. Furthermore, display information in reverse order by part number pNo COUNT (pNo) SUM(qty) MIN(qty) AVG(ty MAX(qty) AVGqty P5 1 P4 2 P33 P2 4 P1 3 100 400 1000 1000 700 100 200 200 200 100 100.0000 100 200.0000 200 333.3333 400 250.0000 400 233.3333 300 246.1538 246.1538 246.1538 246.1538 246.1538 Use the provded tables below to answer the following questions sName Smith sCity SI S2 PI P2 P3 P4 PS Nut Bolt Red Blue 12 17 17 10 Blake Paris Screw Red S4. S5 30 Athens Blue 12 SP SNo (PK) (FK S1 S1 S1 S1 S1 S2 S2 S3 S3 S3 S4 P1 P2 P3 P4 PS PI P2 Pl P2 P3 P2 P3 P4 200 100 100 200 200 200 S5 Table: Content of the Supplier-Parts DB Tables
Step 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