edited by
1,612 views
1 votes
1 votes

Consider the following database table
Supplier (Sid, Sname, rating)
Parts (Pid, Pname, color)
Catalog (Sid Pid, cost)
Which of the following SQL query correct representation to retrieve Sid’s who supplied every red part.

edited by

1 Answer

0 votes
0 votes
Here both queries are wrong let's take example of first query

Let a table p which contain more then 1 parts with red colour and distinct pid now when we use ALL... If all the records contain red parts , but distinct pid it will return the records but this will be wrong output since in the question it is asking to retrieve SID which is supplier of each and every red part present in the parts table.

Now coming to the second table it is also wrong since EXIST returns true if there are SID which are supplier of some red parts... (At least one also) but this won't be also correct output

Second query would have been correct if there EXISTS was replaced by NOT EXISTS since it returns true for records wich are related to each and every record of particular condition in main table..

Related questions

1 votes
1 votes
1 answer
2
charul asked Jan 16, 2018
402 views
here for 1st relation algebra operation the join operation is given without condition , will it be considered as natural join or cartesian product?
–1 votes
–1 votes
0 answers
3
Himanshu Kashyap asked Jan 12, 2019
658 views
PLEASE EXPLAIN WHEATHER IT WOULD BE SOME EC DEPARMENT OR ALL EC DEPARTMENT I THINK ALL BECOZ IT IS SELECTION EID OF STUDENT WHO HAVE NOT ENROLLED IN ANY COURSE OF EC