Question: Consider a simple relational database for a taxi company consisting of the following relations: Customer (CId, CName, CAddress, CPhone) Driver (DId, DName, DAddress, DPhone) Trip

 Consider a simple relational database for a taxi company consisting of

Consider a simple relational database for a taxi company consisting of the following relations: Customer (CId, CName, CAddress, CPhone) Driver (DId, DName, DAddress, DPhone) Trip (CId DId. LicNo, CallTime, StartLoc, EndLoc, StartTime, EndTime, Fare, Tip, TripRating) Taxi (LicNo, ModelName, ModelYear) TaxiDriver (LicNo DId) In this scenario CId is the ID of a customer, DId is the ID of a driver, and LicNo is the license number of the taxi, CallTime is the time when the customer called for a taxi, and StartTime is the actual time when the trip started. StartLoc and EndLoc are the start and end addresses of the trip. TripRating is a rating between 1 and 5 given by the customer for the particular trip. A driver can drive several different taxis and a taxi can have several drivers, and table TaxiDriver stores which driver is allowed to drive which taxi. A taxi can only be called via phone for immediate pickup, and cannot be booked in advance for future use. The primary key attributes for each relation have been underlined. I. Create an ER Diagram for the above Business Rules. Label all entities and relationships. Show cardinality and optionality II. In the Trip table, (CId, DId, LicNo, CallTime) is the primary key. Could (Cld Did, LicNo, Startloc) be a primary key? Could (Dld, StartTime) be a primary key? Explain. III. Identify appropriate foreign key relationships between the tables IV. Write statements in SQL for the following queries a. List the license numbers and model names of all taxis that are model year 2005 b. List the driver and customer names for all trips with a fare greater than $100. c. List the destinations, fares, and tips of all trips that started from location '199 Chambers St. Manhattan d. List the names of all drivers who have driven more than one taxi in 2014. e. Provide the name of the driver(s) who received the highest (single- trip) tip ever. f. For each driver, output the Did, name, and average trip rating. g. Output the DId and name of any driver who has never received a rating of 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!