Database Management System
Database Management System
Lab Experiments
Name: Jaanaavi Wasade
Registration Number:18BCE0743
no data found.
2. Find the train names that are superfast and the service tax is zero.
SERVICE_TAX=0;
no data found.
3.Find the Passenger name who have booked for the train that starts from 'Chennai'.
SQL> SELECT P_NAME FROM PASSENGER WHERE PNR_NO IN (SELECT PNRNO FROM
TICKET WHERE
TRAIN_NUMBER IN ( SELECT TRAIN_NUMBER FROM TRAIN WHERE SOURCE =
'CHENNAI' ));
no data found.
4. Find the trains names that have all the AC coaches and the base fare is less than 3000 for each case.
SQL> SELECT TRAIN FROM TRAIN WHERE TRAIN_NO IN (SELECT TRAIN_NO FROM
TRAIN_TICKET_FARE WHERE CLASS='1A' OR CLASS = '2A' OR CLASS = '3A' AND
BASEFARE < 3000)
no data found.
2. Find the train names that are superfast and the service tax is zero.
no data found.
3. Find the Passenger name (and train name) who have booked for the train that starts from 'Chennai'.
SQL> SELECT Train.train_number, Train.name, Passenger.Name FROM Passenger INNER JOIN
Train, Ticket ON Passenger.PNRNo=Ticket.PNRNo WHERE Ticket.from_station=’CHENNAI’;
no data found.
Complex querries
1. List the train names and the number of substations it has.
GROUP BY (tostation);
4. Create a table cancellation history(insert values from ticket and passenger table)
5. Create a table for all the train numbers and class available in train_ticket_fare with total seats.
SQL>CREATE TABLE SETS AS SELECT trainnumber,class FROM TIC_FARE
6.Find the station name that has highest number of train stopping at.
GROUP BY (tostation);