A relational schema for a train reservation database is given below.…

PYQ GATE 2010

A relational schema for a train reservation database is given below.

Passenger(pid, pname, age)

Reservation(pid, class, tid)

What pids are returned by the following SQL query for the above instance of the tables?

SELECT pid
FROM Reservation
WHERE class = 'AC' AND EXISTS (
    SELECT *
    FROM Passenger
    WHERE age > 65 AND Passenger.pid = Reservation.pid
)
  1. A.

    1, 0

  2. B.

    1, 2

  3. C.

    1, 3

  4. D.

    1, 5

Attempted by 264 students.

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…