Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 1. (80 points) Consider the relational database defined below: create table passenger ( passenger_ID varchar (10), passenger_name varchar (30), passenger_city varchar (30), primary key
Problem 1. (80 points) Consider the relational database defined below: create table passenger ( passenger_ID varchar (10), passenger_name varchar (30), passenger_city varchar (30), primary key (passenger_ID)); create table seat ( train_number varchar (10), seat_number varchar (10), primary key (train_number, seat_number)); create table reservation ( reservation_number varchar(10), passenger_ID varchar (10), train_number varchar (10), seat_number varchar (10), departure_station varchar(10), departure_time timestamp, arrival station varchar(10), arrival time timestamp , fare numeric(8, 2), primary key (reservation_number), foreign key (passenger_ID) references passenger, foreign key (train_number, seat_number) references seat); (e) (10 points) Find the ID of every passenger who lives in (i.e., whose passenger_city is) 'Albany' and has never reserved any trip. For this query, use a left outer join. (f) (10 points) For each reservation whose departure time is between '2021-04-01 00:00:00' and '2021-04-02 23:59:59' (inclusive), update the fare as follows: If the current fare is greater than $100, decrease the fare by 5 percent. Otherwise, decrease the fare by 3 percent. (g) (10 points) Find the train(s) with the largest number of seats (i.e., trains with more seats or the same number of seats compared to every other train). For each of these trains, show the train number. (h) (10 points) Find all of the trains whose seats were all reserved at least once on '2019-04-01'. For each of these trains, show the train number
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started