GATE Assistant

Past questions › Computer Science and Information Technology › GATE 2020

GATE 2020 · CS · MCQ · 1 mark · Databases › SQL

GATE 2020 Computer Science and Information Technology question: Consider a relational database containing the following schemas. The primary key of each…

Consider a relational database containing the following schemas.

figure

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

  1. (A)

    4

  2. (B)

    5

  3. (C)

    0

  4. (D)

    2

Show answer

Official answer: A

Practise this question with exam-style marking

Discussion

No discussion yet.

Join the discussion