Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use the following tables below to answer the questions sName Smith sCity SI S2 PI P2 P3 P4 PS Nut Bolt Red Blue 12 17

image text in transcribed

image text in transcribed

Use the following tables below to answer the 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 Write the following SQL statements to show corresponding data displaved in each table for each questions Find supplier numbers who supply any screws (i.c., such that the part name is 'screw"). The constraint is that you may not use any join or cross (product) (Hint: Use subquery(ies).) sNo S3 S4 S5 Display the total number of orders (over all parts) and the minimum, average, and maximum quantity of individual orders (each order is a tuple in sp). COUNT(pNo) SUM(qty) MIN(qty) AVG(qty) MAX(qty) 13 3200 100 246.1538 40 For each 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, but only for those parts for which the average quantity on order is greater than the average quantity on order over all parts. 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(qty) MAX(qty) AVGqty P3 P2 4 1000 1000 200 200 333.3333 400 250.0000 400 246.1538 246.1538 Find cach 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. 4 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 SAs 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 Screww P4 200 200.0000 Screw P5 100 100.0000 Cam pName

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_2

Step: 3

blur-text-image_3

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

Database Systems For Advanced Applications Dasfaa 2023 International Workshops Bdms 2023 Bdqm 2023 Gdma 2023 Bundlers 2023 Tianjin China April 17 20 2023 Proceedings Lncs 13922

Authors: Amr El Abbadi ,Gillian Dobbie ,Zhiyong Feng ,Lu Chen ,Xiaohui Tao ,Yingxia Shao ,Hongzhi Yin

1st Edition

3031354141, 978-3031354144

More Books

Students also viewed these Databases questions

Question

4. How is culture a contested site?

Answered: 1 week ago