A relational schema for a train reservation database is given below.…
GATE · 2010 · CS · Computer Science & IT
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
)- A.
1, 0
- B.
1, 2
- C.
1, 3
- D.
1, 5
Attempted by 212 students.
Sign up free to check your answer
Sign up freeLoading lesson…