Suppliers(Sid: integer, sname:string, city:string, street:string) Parts(pid:integer, pname:string, color:string) Catalog(sid:integer, pid:integer, cost:real) Consider the following relational query on the above database: SELECT S.sname 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’)) Assume that relations corresponding to the above schema are not empty. Which of the following is the correct interpretation of the above query?

Suppliers(Sid: integer, sname:string, city:string, street:string) Parts(pid:integer, pname:string, color:string) Catalog(sid:integer, pid:integer, cost:real) Consider the following relational query on the above database: SELECT S.sname 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’)) Assume that relations corresponding to the above schema are not empty. Which of the following is the correct interpretation of the above query? Correct Answer Find the names of all suppliers who have not supplied only blue parts  

The correct answer is "option 4".

EXPLANATION:

The above query will return the Name of all suppliers who will not supply blue parts, which means it can include non-blue parts & null values.

Consider the following table:

 Name

ID

COLOR

      A

1

Blue

B

2

Blue

C

3

Blue

D

4

Blue

E

5

Red

F

6

Red

G

7

Red

H

8

Red

I

9

Null

J

10

Null

 

The QUERY "SELECT P.pid FROM Parts P WHERE P.color < > ‘blue’ " will give:

  NAME

ID

COLOR

E

5

red

F

6

Red

G

7

Red

H

8

Red

I

9

Null

      J

10

Null

 

The Query "SELECT C.sid FROM Catalog C WHERE C.pid NOT IN (SELECT P.pid FROM Parts P

WHERE P.color < > ‘blue’)" will give :

NAME

ID

COLOR

A

1

Blue

B

2

Blue

C

3

Blue

D

4

Blue

 

The query " SELECT S.sname 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’)) " will give :

NAME

ID

COLOR

E

5

Red

F

6

Red

G

7

Red

H

8

Red

I

9

Null

J

10

Null

 

Option 1: FALSE

The non-blue part does not include the Null values.

Option 2: FALSE

It will include both Null values and Blue parts.

Option 3: FALSE

It will include only Blue parts.

Option 4: TRUE

It will include non-blue parts and null values.

Hence, The correct answer is "option 4".

Related Questions

Statement 1: We can create foreign key constraints on relational schema derived from ER diagram Statement 2: Relational schema cannot be derived from an ER diagram
Consider the following relational schema: employee(empId,empName,empDept) customer(custId,custName,salesRepId,rating) salesRepId is a foreign key referring to empId of the employee relation. Assume that each employee makes a sale to at least one customer. What does the following query return? SELECT empName FROM employee E WHERE NOT EXISTS (SELECT custId FROM customer C WHERE C.salesRepId = E.empId AND C.rating <> ’GOOD’);
Consider the following relation schema Sailors(sid, sname, rating, age) Reserve(sid, bid, day) Boats(bid, bname, color) What is the equivalent of following relational algebra query in SQL query. πsname((σcolor= ‘red’Boats) ⨝ Reserves ⨝ Sailors)