need to design a database for the case study described: The Business Problem Our
ID: 3720405 • Letter: N
Question
need to design a database for the case study described:
The Business Problem Our company does car rental business and has several locations with different addresses (address consist of street or rural route with the number, city, state and zip code). The cars are classified as subcompacts, compacts, sedans, or luxury. Each car has a particular make, model, year made, and color. Each car has a unique identification number and a unique license plate. The cars rented in a particular location may be returned to a different location (so called drop off). For every car we keep the odometer reading before it is rented and after it is returned. Since we trust our customers, we do not record any defects when the car is rented out and returned back. However, we rent the car with a full tank and record the volume of gas in the tank when the car is returned, but we only indicate if the tank is empty, quarter full, half full, three quarters full, or full. We keep track of which day a car was rented, but not of the time, similarly for car returns. If a customer requests a specific class (say sedan), we may rent the customer a higher-class car if we do not have the requested class in the stock, but we will price it at the level the customer requested (so-called upgrade). Each car class has its own pricing, but all cars in the same class are priced the same. We have rental policies for 1 day, 1 week, 2 weeks, and 1 month. Thus, if a customer rents a car for 8 days, it will be priced as 1 week + 1 day. The drop-off charge only depends on the class of the rented car, the location it was rented from and the location it is returned to. About our customers, we keep their names, addresses, all phone numbers, and the number of the driver’s license (we assume a unique license per person). About our employees we keep the same information (we require that all our employees have a driver’s license). We have several categories of workers: drivers, cleaners, clerks, and managers. Any of our employees can rent a car from our company for a 50% discount, if the rental is less than 2 weeks. However, for any longer rental they must pay 90% of the regular price. Every employee works in one location only. We have headquarters in Hamilton. The people who work there are all classified as managers, one of them is the president, two of them are the vice-presidents, one for operations, the other for marketing). For certain weeks we have promotional rentals that are usually 60% of the regular price, but may be also of different percentage. They always affect only a single class of cars – i.e. we may have a promotion for subcompacts, but during that week we do not have any promotions for compacts, sedans or luxury cars. During some years we can have many promotions, in some we have none. The promotions cannot be applied to employee rentals. Transactions to be Supported - Add a new car to our car inventory. - Add a new customer to our list of customers. - List the names of all customers who are currently renting a car from our company. - List the make, model, year, and classification (i.e. subcompact, compact, etc.) of all cars currently rented out. - For each completed rental, list the rental price and the rental identification number. - List the rental identification number, make, model, year, classification, and rental
Explanation / Answer
Tables Creation for Database:
create database carApp;
1) Table for Car:
/* Car table is used to store the car information and details of car including all details. */
CREATE TABLE Car (
carId int,
carType varchar(255),
address varchar(255),
makeType varchar(255),
model varchar (255),
location varchar(255),
beforeoadmeterreading int,
afteroadmeterreading int,
price double,
madeyear varchar(255),
licplateno varchar(255),
rentdays int,
dropoff varchar(255),
PRIMARY KEY (carid)
);
2) Table for Customer:
/* Customer table is used to store customer information along with the car takeen*/
create table customer (
custId varchar(255),
custName varchar(255),
address varchar(255),
phoneno varchar(12),
licenceNo varchar(15),
carType varchar(255),
carprice double,
datetaken varchar(255),
amount double,
primary key(custId)
);
3) Table for Employee:
/* Employee table is used to store employeee information along with the car discount*/
create table emp (
empId varchar(255),
empName varchar(255),
address varchar(255),
phoneno varchar(12),
licenceNo varchar(15),
empcatagiry varchar(255),
rent varchar(255),
branch varchar(255),
primary key(empId) );
Using above
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.