Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Scenario and Database Model: InstantRide InstantRide is the new ride sharing application in the city and it has just started its operations. With the help
Scenario and Database Model: InstantRide
InstantRide is the new ride sharing application in the city and it has just started its operations. With the help of the InstantRide mobile application, the users request a ride with their location. Drivers and cars are assigned to the request; and then the driver picks up the user to ride their requested location. Information for the users, drivers and cars are stored in the database as well as the travel transactions.
In the USERS table, information for the users are stored with their first name, last name and email:
USERS Table
USERS Table
In the DRIVERS table, all the drivers in the InstantRide are stored with their name, driving license number and check and rating information:
DRIVERS Table
DRIVERS Table
In the CARS table, all the cars in the InstantRide system are kept with the license plate, model and year:
CARS Table
CARS Table
Finally, the transactions of the rides are stored in the TRAVELS table. For each travel, start and end time with location are stored. In addition, the involved driver, car and user are listed for each drive. Price and discount information are also available in the database:
TRAVELS Table
TRAVELS Table
You are assigned as the database administrator to collect and manage transactional data of the InstantRide operations. Your main task is to create SQL scripts to help other teams to retrieve the requested data. In the following activities, you will create the scripts, run against the database and send the result to the corresponding teams.
Task :
The InstantRide Management team founded a new team for car maintenance. The new team is responsible for the small maintenance operations for the cars in the InstantRide system. The main idea is to take actions faster and minimize the time spent for the maintenance. Therefore, the Car Maintenance team wants to store MAINTENANCETYPEID char and a MAINTENANCETYPEDESCRIPTION varchar in the database. Using MAINTENANCETYPEID as the PRIMARY KEY, create a new table, MAINTENANCETYPES and send the table description with the column names and types to the Car Maintenance team.
Task : Create a new table to store car maintenance types.
Task :
The Car Maintenance team also wants to store the actual maintenance operations in the database. The team wants to start with a table to store CARID CHAR MAINTENANCETYPEID CHAR and MAINTENANCEDUE DATE date for the operation. Create a new table named MAINTENANCES. The PRIMARYKEY should be the combination of the three fields. The CARID and MAINTENANCETYPEID should be foreign keys to their original tables. Cascade update and cascade delete the foreign keys.
Task : Create a new table to store maintenance operations.
Task :
The Driver Relationship team wants to create some workshops and increase communication with the active drivers in InstantRide. Therefore, they requested a new database table to store the driver details of the drivers that have had at least one ride in the system. Create a new table, ACTIVEDRIVERS##from the DRIVERS and TRAVELS tables which contains the following fields:
DRIVERID CHARPrimary key
DRIVERFIRSTNAME VARCHAR
DRIVERLASTNAME VARCHAR
DRIVERDRIVINGLICENSEID VARCHAR
DRIVERDRIVINGLICENSECHECKED BOOL
DRIVERRATING DECIMAL
Task : Create a new table to store the information of active drivers.
Task :
The Driver Relationship team wants to have quick search options for the active drivers. The team specifically mentioned that they are using first name, last name and driving license ID to search the drivers. Create an index called NameSearch on the ACTIVEDRIVERS table created in task
Task : Create an INDEX to search for driver information.
Task :
The Driver Relationship team requested to ensure that there will be no duplicates in the active drivers tables in terms of first name, last name and driving license ID You need to create a constraint in the ACTIVEDRIVERS table, called DuplicateCheck to ensure the first name, last name, and the driving license ID are unique.
Task : Create a constraint on the ACTIVEDRIVERS table
Task :
The Car Maintenance team considered that the available maintenance tasks should also have the price information in the database. Alter the MAINTENANCETYPES table to include a new column named MAINTENANCEPRICE of type DECIMAL
Task : Alter the MAINTENANCETYPES table to include pricing information.
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