GATEverse
← GATE CSE 2010

Q19

MCQ1 mark, −0.33

A relational schema for a train reservation database is given below. passenger(pid, pname, age) reservation(pid, class, tid)

pidpnameAge0Sachine651Rahul662Sourav673Anil69Passengerpidclasstid0AC82001AC82012SC82015AC82031SC82043AC8202Reservation\overset{\text{Passenger}}{\begin{array}{|c|c|c|}\hline\\ \textbf{pid}& \textbf{pname}& \textbf{Age} \\\hline 0& \text{Sachine}& 65 \\ \hline 1& \text{Rahul}& 66 \\ \hline 2& \text{Sourav}& 67 \\\hline 3& \text{Anil}& 69 \\\hline \end{array}} \qquad \overset{\text{Reservation}}{\begin{array}{|c|c|c|}\hline\\ \textbf{pid}& \textbf{class}& \textbf{tid} \\\hline 0& \text{AC}& 8200 \\ \hline 1& \text{AC}& 8201 \\ \hline 2& \text{SC}& 8201 \\\hline 5& \text{AC}& 8203 \\\hline1& \text{SC}& 8204 \\\hline3& \text{AC}& 8202 \\\hline \end{array}}

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)

Sign in to save attempts.

Loading…