Database Project Report 2025[1]
Database Project Report 2025[1]
PROJECT REPORT
5/30/2025
TABLE OF CONTENTS
1. Abstract
2. Introduction
3. Problem Statement
4. Project Goal
5. System Design & Implementation
ER Diagram
Relational Model
Relational Schema
6. Normalization
7. SQL Implementation
DDL
DML
Select Queries
8. Results & Outputs
9. Database Connection with OOP Code
10.Conclusion
11.References
2|DATABASE SYSTEM REPORT
1. Abstract:
2. Introduction:
3. Problem Statement:
Manual vehicle booking and management systems are time consuming and inefficient.
Showrooms can’t manage their records for sales accurately. There is no digital storage of
customer and vehicle data for the showroom. Manual records maintenance becomes complex
when number of vehicles and customers increase. That’s why showrooms needs a trustable and
efficient management system for handing their records easily.
4. Project Goal:
To design and implement a Vehicle Showroom Management System that manages vehicle
inventory and bookings efficiently. It may help the showrooms to manage their records and store
them at a safe place.
3|DATABASE SYSTEM REPORT
1. Customer
o CustomerID (PK)
o Name
o Contact Number
o Email
o Address
2. Vehicle
o VehicleID (PK)
o VehicleName
o Model
o Ex_Price
o Engine
o BodyType
3. Booking
o BookingID (PK)
o Booking Date
o Delivery Date
o VehicleID (FK)
o CustomerID (FK)
o EmployeeID (FK)
4. Payment
o PaymentID (PK)
o Amount
o Payment Date
o Payment Method
o BookingID (FK)
5. Employee
o EmployeeID (PK)
o Name
o Designation
o Contact
6. Showroom
o ShowroomID (PK)
o Name
o Location
o Contact Number
7. Service Record
o ServiceID (PK)
o ServiceDate
o Description
o ServicedBy
o VehicleID (FK)
4|DATABASE SYSTEM REPORT
Relational Model:
Relational Schema:
6. Normalization:
1st NF
6|DATABASE SYSTEM REPORT
Tables are already in 1st NF because there are no multi-valued fields and no repeating groups.
2nd NF
Tables are in 2nd NF because they are in 1st NF and there is no partial dependency (non-key
attributes depending on part of composite key).
3rd NF
Tables are in 3rd NF because they are in 2nd NF and there is no transitive dependency (non-key
attributes depending on other non-key attribute).
7. SQL Implementation:
DDL:
Engine INT,
Ex_Price INT
);
VehicleID INT,
FOREIGN KEY(ServicedBy) REFERENCES Employee(EmployeeID),
FOREIGN KEY(VehicleID) REFERENCES Vehicle(VehicleID)
);
DML:
o INSERT
INSERT INTO
Vehicle(VehicleID,VehicleName,Model,Engine,Ex_Price,BodyType)
VALUES
(1,'Corolla', 2024, 44, 10000, 'Sedan'),
(2,'Tesla', 2014, 55, 9900, 'SUV'),
(3,'Civic', 2015, 25, 6900, 'Hatchback');
INSERT INTO
Employee(EmployeeID,Name,Designation,Contact,ShowroomID) VALUES
(201,'Saim Ayub','Manager','03005551234','501'),
(202,'Fakhar Zaman','Sales Executive','03211231234','501'),
(203,'Muhammad Amir','Manager','03097552323','502');
INSERT INTO
Booking(BookingID,BookingDate,DeliveryDate,VehicleID,CustomerID,Emp
loyeeID) VALUES
(301,'2025-05-10','2025-05-15',3,101,202),
(302,'2025-05-12','2025-05-18',2,102,201);
INSERT INTO
Payment(PaymentID,Amount,PaymentDate,PaymentMethod,BookingID)
VALUES
(401,5200000,'2025-05-11','Card',301),
(402,6500000,'2025-05-13','Cash',302);
9|DATABASE SYSTEM REPORT
INSERT INTO
ServiceRecord(ServiceID,ServiceDate,Description,ServicedBy,VehicleID)
VALUES
(601,'2025-05-20','Oil change',201,3),
(602,'2025-05-22','Brake pad replacement',202,2);
o UPDATE
UPDATE Vehicle SET Engine = 1400 WHERE VehicleID=2;
UPDATE Showroom SET ContactNumber = '03097552323' WHERE
ShowroomID=502;
o DELETE
DELETE FROM Customer WHERE CustomerID = 101;
DELETE FROM Vehicle WHERE VehicleID=3;
Select Queries:
--SIMPLE QUERIES--
SELECT * FROM Customer;
SELECT Name, CustomerID FROM Customer;
SELECT * FROM Vehicle WHERE BodyType = 'Sedan';
SELECT DISTINCT VehicleName FROM Vehicle;
SELECT COUNT(ShowroomID) AS TotalShowrooms FROM Showroom;
SELECT * FROM Employee WHERE Designation = 'Manager' AND ShowroomID
= 502;
SELECT * FROM Vehicle ORDER BY Ex_Price ASC;
SELECT * FROM Payment ORDER BY Amount DESC;
SELECT Model,BodyType FROM Vehicle WHERE Ex_Price BETWEEN 7000
AND 10000;
/*------------------*/
/*JOINS*/
-- Inner Join
SELECT * FROM Booking INNER JOIN Customer ON Booking.CustomerID =
Customer.CustomerID;
-- Left Outer Join
SELECT * FROM Vehicle LEFT OUTER JOIN Booking ON Vehicle.VehicleID =
Booking.VehicleID;
-- Right Outer Join
SELECT * FROM Showroom RIGHT OUTER JOIN Employee ON
Showroom.ShowroomID = Showroom.ShowroomID;
-- Full Outer Join
10 | D A T A B A S E S Y S T E M R E P O R T
/*SUBQUERIES*/
SELECT EmployeeID, Name, Designation, Contact FROM Employee WHERE
ShowroomID = (SELECT ShowroomID FROM Showroom WHERE Location =
'Multan');
SELECT VehicleID, VehicleName, Model, Ex_Price, Ex_Price - (SELECT
AVG(Ex_Price) FROM Vehicle) AS PriceDifference FROM Vehicle WHERE
Ex_Price > (SELECT AVG(Ex_Price) FROM Vehicle);
SELECT * FROM Booking WHERE VehicleID IN (SELECT VehicleID FROM
Vehicle WHERE BodyType IN ('Sedan', 'SUV'));
SELECT EmployeeID, Name, Designation, Contact FROM Employee WHERE
ShowroomID NOT IN (SELECT ShowroomID FROM Showroom WHERE Location
= 'Lahore');
SELECT * FROM Booking WHERE EmployeeID IN (SELECT EmployeeID FROM
Employee WHERE ShowroomID = (SELECT ShowroomID FROM Showroom
WHERE Location = 'Multan'));
SELECT * FROM Payment WHERE Amount > SOME (SELECT Amount FROM
Payment WHERE PaymentID = 401);
11 | D A T A B A S E S Y S T E M R E P O R T
SELECT * FROM Payment WHERE Amount < ALL (SELECT Amount FROM
Payment WHERE PaymentID = 402);
SELECT CustomerID, Name, ContactNumber, Email, Address FROM Customer
WHERE EXISTS (SELECT * FROM Booking WHERE Customer.CustomerID =
Booking.CustomerID);
SELECT CustomerID, Name, ContactNumber, Email, Address FROM Customer
WHERE NOT EXISTS (SELECT * FROM Booking WHERE Customer.CustomerID
= Booking.CustomerID);
SELECT Address AS City FROM Customer WHERE Address IS NOT NULL
UNION SELECT Location AS City FROM Showroom WHERE Location IS NOT
NULL;
SELECT Address AS City FROM Customer WHERE Address IS NOT NULL
INTERSECT SELECT Location AS City FROM Showroom WHERE Location IS
NOT NULL;
SELECT Name FROM Employee WHERE ShowroomID IN (SELECT ShowroomID
FROM Showroom WHERE Location = 'Multan')AND EmployeeID IN (SELECT
EmployeeID FROM Booking WHERE VehicleID = 3);
/*-------------------*/
---VIEWS CALLING---
SELECT * FROM SimpleCustomerBooking;
SELECT * FROM SimpleVehicleService;
/*-------------------*/
---FUNCTIONS CALLING---
SELECT dbo.GetEmployeeDescription('Saim Ayub', 'Manager') AS Description;
---TRIGGER CALLING---
UPDATE ServiceRecord SET Description = 'Engine tuning' WHERE ServiceID =
601;
/*-------------------*/
12 | D A T A B A S E S Y S T E M R E P O R T
---TRANSACTION---
BEGIN TRANSACTION;
BEGIN TRY
INSERT INTO Booking (BookingID, BookingDate, DeliveryDate, VehicleID, CustomerID,
EmployeeID)
VALUES (303, '2025-06-01', '2025-06-05', 1, 103, 203);
COMMIT;
PRINT 'Booking and payment saved successfully.';
END TRY
BEGIN CATCH
ROLLBACK;
PRINT 'Error occurred. Transaction rolled back.';
END CATCH;
We have connected our database project table Vehicle with our OOP project code using Dev C+
+ and MySQL. New vehicles can be added from the console and saved in the database table.
Then we can retrieve data on the Command Line Client or MySQL Workbench by writing
Queries.
15 | D A T A B A S E S Y S T E M R E P O R T
10.Conclusion:
The Vehicle Showroom Management System helps manage all the important records and
activities related to vehicles in a showroom. It keeps track of customers, vehicles, bookings,
11.References: