GATE Computer Science (CS) 2020 Solved Papers
© examsnet.com
Question : 19
Total: 65
Consider a relational database containing the following schemas.
Catalogue
Suppliers
Parts
The primary key of each table is indicated by underlining the constituent fields
SELECT s.sno, s.sname
FROM Suppliers s, Catalogue c
WHERE s.sno = c.sno AND
Cost > (SELECT AVG (cost)
FROM Catalogue
WHERE pno = ‘P4’GROUP BY pno);
The number of rows returned by the above SQL query is
Catalogue
sno | pno | cost |
s1 | p1 | 150 |
s1 | p1 | 50 |
s1 | p3 | 100 |
s2 | p4 | 200 |
s2 | p5 | 250 |
s3 | p1 | 250 |
s3 | p2 | 150 |
s3 | p5 | 300 |
s3 | p4 | 250 |
sno | sname | location |
s1 | M/s Royal furniture | Delhi |
s2 | M/s Balaji furniture | Bangal |
s3 | M/s Premium furniture | Chennai |
pno | pname | part_spec |
p1 | Table | Wood |
p2 | Chair | Wood |
p3 | Table | Steel |
p4 | Almirah | Steel |
p5 | Almirah | Wood |
SELECT s.sno, s.sname
FROM Suppliers s, Catalogue c
WHERE s.sno = c.sno AND
Cost > (SELECT AVG (cost)
FROM Catalogue
WHERE pno = ‘P4’GROUP BY pno);
The number of rows returned by the above SQL query is
Go to Question: