0% found this document useful (0 votes)
6 views2 pages

Car Rental System Project

The Car Rental Management System is a database designed to manage customer, car, rental, and payment records. It includes an ER diagram outlining the relationships between entities and a relational schema detailing the structure of the database tables. Additionally, SQL code is provided for creating the database and sample queries for retrieving data from the system.

Uploaded by

iramyasmintrader
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Car Rental System Project

The Car Rental Management System is a database designed to manage customer, car, rental, and payment records. It includes an ER diagram outlining the relationships between entities and a relational schema detailing the structure of the database tables. Additionally, SQL code is provided for creating the database and sample queries for retrieving data from the system.

Uploaded by

iramyasmintrader
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Car Rental Management System

Introduction
Car Rental Management System is a database system used to manage customers, cars, rentals,
and payments. It helps to keep records of which customer rents which car, for how many days, and
how much payment is made.

ER Diagram (Concept)
Entities: Customer, Car, Rental, Payment
Relationships:
• One Customer can have many Rentals (1:M)
• One Car can have many Rentals (1:M)
• One Rental has one Payment (1:1)

Relational Schema
Customer CustomerID (PK), Name, Phone
Car CarID (PK), Model, Brand, PricePerDay, Status
Rental RentalID (PK), CustomerID (FK), CarID (FK), RentDate, ReturnDate
Payment PaymentID (PK), RentalID (FK), Amount, PaymentDate

SQL Code

CREATE DATABASE CarRentalDB;


USE CarRentalDB;

CREATE TABLE Customer (


CustomerID INT PRIMARY KEY,
Name VARCHAR(50),
Phone VARCHAR(15)
);

CREATE TABLE Car (


CarID INT PRIMARY KEY,
Model VARCHAR(50),
Brand VARCHAR(50),
PricePerDay INT,
Status VARCHAR(20)
);

CREATE TABLE Rental (


RentalID INT PRIMARY KEY,
CustomerID INT,
CarID INT,
RentDate DATE,
ReturnDate DATE,
FOREIGN KEY (CustomerID) REFERENCES Customer(CustomerID),
FOREIGN KEY (CarID) REFERENCES Car(CarID)
);

CREATE TABLE Payment (


PaymentID INT PRIMARY KEY,
RentalID INT,
Amount INT,
PaymentDate DATE,
FOREIGN KEY (RentalID) REFERENCES Rental(RentalID)
);

Sample Queries
1 SELECT * FROM Customer;
2 SELECT * FROM Car;
3 SELECT [Link], [Link] FROM Rental r JOIN Customer c ON [Link]=[Link]
JOIN Car car ON [Link]=[Link];

You might also like