Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.Consider the following relational database schema. The primary keys are tagged with 'PK' and the foreign keys are self-explanatory. Train(train_number (PK), name, source, destination, start_time,

1.Consider the following relational database schema. The primary keys are tagged with 'PK' and the foreign keys are self-explanatory.

Train(train_number (PK), name, source, destination, start_time, reach_time, traveltime, distance, class, days, type) Ticket( PNR_no (PK),Transactionid, from_station, To_station, date_of_journey, class date_of_booking, total_ticket_fare, train_number) Passenger(PNR_no, Serial_no, Name, Age, Reservation_status, PK(PNR_no, Serial_no)) Train_Route(Train_no, route_no, station_code, name, arrival_time, depart_time, distance,day, PK(Train_no, route_no)) Train_Ticket_fare(Train_no, class, base_fare, reservation_charge, superfast_charge, other_charge, tatkal_charge, service_tax, PK(Train_no, class)).

Implement and test the SQL statement for the following queries based on the above schema. (a) Display the PNR number of tickets booked for traveling from Bengaluru to Mumbai with date of journey a fortnight from today. (b) Find out the average travel time of trains passing through Solapur station after originating from Mumbai. (c) Display reservation status of passenger replacing the string WL by the string RAC, passenger name with right padding character and departure time of the train the passenger is traveling by in 12 hour format, using a single SQL statement. (d) List the name of passengers who never traveled by Rajdhani Express but did travel by superfast train. (e) Use nested query to display source and destination of trains traveled by the passenger aged below twenty years. (f) Use join query to display total ticket fare and date of booking for tickets booked for superfast trains starting from Mumbai. (g) Display train name and the average total ticket fare for second AC coach in each train. (h) Display the name of the train that carried at least 500 passengers aged above 30 years. (i) Write the necessary SQL statement to cancel all tickets booked between March 1, 2020 and March 23, 2020. (j) Use outer join to display name of the trains irrespective of whether there is any reservation for the train.Immersive Reader

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Accounting questions