Skip to content

Beta · Data may be lost.Your data may be reset or lost.

GateBrew
← GATE CSE 2020
Questions

Q13

MCQ1 mark, −0.33Databases

Consider a relational database containing the following schemas.

sno‾pno‾costS1P1150S1P250S1P3100S2P4200S2P5250S3P1250S3P2150S3P5300S3P4250Cataloguesno‾snamelocationS1M/s Royal furnitureDelhiS2M/s Balaji furnitureBangaloreS3M/s Premium furnitureChennaiSupplierspno‾pnamepart_specP1TableWoodP2ChairWoodP3TableSteelP4AlmirahSteelP5AlmirahWoodParts\overset{\text{Catalogue}} {\begin{array}{|c|c|c|} \hline \underline{\text{sno}} & \underline{\text{pno}} & \text{cost} \\ \hline S1 & P1 & 150 \\ \hline S1 & P2 & 50 \\ \hline S1 & P3 & 100 \\ \hline S2 & P4 & 200 \\ \hline S2 & P5 & 250 \\ \hline S3 & P1 & 250 \\ \hline S3 & P2 & 150 \\ \hline S3 & P5 & 300 \\ \hline S3 & P4 & 250 \\ \hline \end{array}} \quad \overset{ \text{Suppliers} }{\begin{array}{|c|c|c|} \hline \underline{\text{sno}} & \text{sname} & \text{location} \\ \hline S1 & \text{M/s Royal furniture} & \text{Delhi}\\ \hline S2 & \text{M/s Balaji furniture} & \text{Bangalore} \\ \hline S3 & \text{M/s Premium furniture} & \text{Chennai} \\ \hline \end{array}} \quad \overset{\text{Parts}}{\begin{array}{|c|c|c|} \hline \underline{\text{pno}} & \text{pname} & \text{part\_spec} \\ \hline P1 & \text{Table} & \text{Wood} \\ \hline P2 & \text{Chair} & \text{Wood} \\ \hline P3 & \text{Table} & \text{Steel} \\ \hline P4 & \text{Almirah} & \text{Steel} \\ \hline P5 & \text{Almirah} & \text{Wood} \\ \hline \end{array}}

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

Sign in to save attempts.

Solutions and discussion are hidden while you attempt this question. They open once you check or show the answer.