1.CarShowRoom(SQL)
1.CarShowRoom(SQL)
“The objective of this project report is to design a relational database system that organizes and
secures key data elements, such as Cars information, Sales record , to create and gain the knowledge
of the database server.”
1. To create a database and use it is commands is given as follows -
Use SibaShowRoom;
Commands:- CREATE TABLE Sales ( SaleID INT PRIMARY KEY AUTO_INCREMENT, VehicleID INT,
CustomerID INT, SaleDate DATE, SalePrice DECIMAL(10, 2) NOT NULL, PaymentMethod
ENUM('Cash', 'Credit', 'Finance') DEFAULT 'Cash', FOREIGN KEY (VehicleID) REFERENCES
Vehicles(VehicleID), FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID) );
Now commands for creating table ‘Customers and Vehicles’ is given below :-
CREATE TABLE Customers ( CustomerID INT PRIMARY KEY AUTO_INCREMENT, FirstName
VARCHAR(50) NOT NULL, LastName VARCHAR(50) NOT NULL, City VARCHAR(50), Phone
VARCHAR(15) UNIQUE, Email VARCHAR(100) );
CREATE TABLE Vehicles ( VehicleID INT PRIMARY KEY AUTO_INCREMENT, Make VARCHAR(50) NOT
NULL, Model VARCHAR(50) NOT NULL, Year INT NOT NULL, Color VARCHAR(20), Mileage INT,
VIN VARCHAR(17) UNIQUE NOT NULL, Price DECIMAL(10, 2) NOT NULL, Status
ENUM('Available', 'Sold', 'Reserved') DEFAULT 'Available' );
Output:-
5. Inserting values to the tables.
Commands :- INSERT INTO Vehicles (Make, Model, Year, Color, Mileage, VIN, Price,
Status) VALUES ('Maruti', 'Swift', 2021, 'White', 12000, 'MH123456789012345', 500000.00,
'Available'), ('Hyundai', 'i20', 2022, 'Blue', 8000, 'MH234567890123456', 700000.00,
'Available'), ('Tata', 'Nexon', 2023, 'Red', 5000, 'MH345678901234567', 800000.00,
'Sold'), ('Mahindra', 'Thar', 2022, 'Black', 3000, 'MH456789012345678', 1200000.00,
'Available'), ('Toyota', 'Fortuner', 2023, 'Silver', 15000, 'MH567890123456789',
2800000.00, 'Sold');
INSERT INTO Customers (FirstName, LastName, City, Phone, Email) VALUES ('Rohit',
'Sharma', 'Mumbai', '9123456789', '[email protected]'), ('Priya', 'Kumar', 'Delhi',
'9876543210', '[email protected]'), ('Ajay', 'Verma', 'Pune', '9988776655',
'[email protected]'), ('Sunita', 'Rao', 'Bangalore', '9123123123',
'[email protected]'), ('Manoj', 'Singh', 'Hyderabad', '9012345678',
'[email protected]');
INSERT INTO Sales (VehicleID, CustomerID, SaleDate, SalePrice, PaymentMethod)
VALUES
(3, 1, '2024-02-14', 780000.00, 'Cash'),
(5, 2, '2024-03-10', 2750000.00, 'Finance'),
(3, 3, '2024-04-18', 790000.00, 'Credit'),
(2, 4, '2024-05-22', 690000.00, 'Cash'),
(1, 5, '2024-07-30', 480000.00, 'Credit');
Output :-
7. Update commands for the table record :-
Commands :-
Commands :-
Commands:-
11. Now sorting function :-
(i) Order By :-
Commands:-
(ii)Group By :-
Commands:-
Commands :-
13. Using Union, Difference and Inersect commands :-
Commands :-
Commands :-
16. Using JOIN Function like inner join and Theta join :-
Commands :-
Inner join
Theta join
Acknowledgment
I would like to express my sincere gratitude to everyone who contributed to the
successful completion of this project. I am deeply thankful to my Mentor, Supriya
Mahanta , for their invaluable guidance, insightful feedback, and continuous
support throughout the course of this project. Their expertise and
encouragement greatly contributed to shaping this work.
Thank you.