1.

Consider the tables given below while attempting the following questions:TrainReservationWith reference to the above given tables, write commands in SQL for (i) and (ii) and output for (iii) below:(i) To display the Train name along with its passenger name. (ii) To display Train detail which has no reservation yet. (iii) SELECT T.* from Train T, Reservation R where T.TrainId=R.TrainId AND Source LIKE “%Delhi” OR Destination LIKE “%Delhi”;

Answer»

(i) select TName, Passenger from Train T, Reservation R where T.TrainId=R.TrainId;

(ii) select T.* from Train T, Reservation R where T.TrainId!=R.TrainId;

(iii)

TrainIdTNameSourceDestination
3424Lucknow MailLucknowNew Delhi
5400Century ExpressNew DelhiKanpur



Discussion

No Comment Found

Related InterviewSolutions