Question

Write the following SQL queries and measure their execution time both with and without using indexes 1. Count how many parts

Please finish all 6 parts. Don't need to do the measure time things, but you can do it if you wanna do it. Thanks!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

--1

select count(part_number) As PartCount From part_nyc where oh_hand>70;

count helps to get number of parts from nyc. Whete clause to filter data;

--2

select SUM(SumOnHand) from (

select (sum(p.on_hand)-sum(s.on_hand))+sum(s.on_hand) SumOnHand FROM part_nyc p LEFT JOIN part_sfo s ON p.part_number=s.part_number group by p.part_number having p.color='Red') As Subtable

In above query i have used calculations first i have removed if same part exist in both table and adding sfo. Using subquery table i have added all column data;

--3

select s.supplier_name from supplier s inner join part_nyc n on s.supplier_id=n.supplier inner join part_sfo s on s.supplier_id=s.supplier group by s.supplier_name having sum(n.on_hand)>sum(s.on_hand);

--4

select supplier_name from supplier where supplier_id in (select supplier from part_nyc) and supplier_id not in (select supplier from part_sfo);

--5

update part_nyc set on_hand=10;

--6

delete * from part_nyc where on_hand<30;

Add a comment
Know the answer?
Add Answer to:
Please finish all 6 parts. Don't need to do the measure time things, but you can do it if you wanna do it. Thanks! Write the following SQL queries and measure their execution time both with and w...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT