in Databases
5,066 views
5 votes
5 votes

Consider the following relational query on the above database:

SELECT S.name FROM Suppliers S 
Where S.sid NOT IN (SELECT C.sid FROM Catalog C
WHERE C.pid NOT IN (SELECT P.pid FROM Parts P WHERE P.color <>'blue'))
  1. Find the names of all suppliers who have supplied non-blue part.
  2. Find the names of all suppliers who have not supplied non-blue part.
  3. Find the names of all suppliers who have supplied only non-blue parts
  4. Find the names of all suppliers who have not supplied only non-blue part.
in Databases
5.1k views

1 comment

Ans (C)

5
5

4 Answers

8 votes
8 votes

Answer : A

Find the names of all suppliers who have supplied non-blue part.

The sub-query “SELECT P.pid FROM Parts P WHERE P.color<> ‘blue’” gives pids of parts which are not blue.

The bigger subquery “SELECT C.sid FROM Catalog C WHERE C.pid NOT IN (SELECT P.pid FROM Parts P WHERE P.color<> ‘blue’)” gives sids of all those suppliers who have supplied blue parts.

The complete query gives the names of all suppliers who have supplied a non-blue part

4 Comments

ISRO answer key is interesting here :)

https://drive.google.com/open?id=0B8_aYGBndW4Hd2JNWDYxYlVpYlU

0
0
answer should be C
0
0
ans is c
0
0
0 votes
0 votes
Answer will be option A and C both as per ISRO-2015 modified answer keys.

1 comment

That itself is a contradiction :)
1
1
0 votes
0 votes
Take an example:

suppliers                              catalog                               parts

---------------------------------------------------------------------------------------------------------

sid                                     sid    pid                              pid    color

--------------------------------------------------------------------------------------------------------

1                                       1       22                               22    Blue

2                                                                                   23   Red

 

Answer (B)
0 votes
0 votes

Answer in (C) Part.

Explanation -->

by
Answer:

Related questions

5 votes
5 votes
3 answers
2