You are on page 1of 2

create a database called CARSHOWROOM

having the schema as mentioned below It has the

following four relations:

1) INVENTORY: Stores name, price, model, year

of manufacturing, and fuel type for each car in

inventory of the showroom,

2) CUSTOMER: Stores customer id, name, address,

phone number and email for each customer,

3) SALE: Stores the invoice number, car id, customer

id, sale date, mode of payment, sales person’s

employee id and selling price of the car sold,

4) EMPLOYEE: Stores employee id, name, date of

birth, date of joining, designation and salary of

each employee in the showroom

CREATE DATABASE CARSHOWROOM;

USE CARSHOWROOM;

CREATE TABLE INVENTORY (

Car_ID INT PRIMARY KEY,

Name VARCHAR(255),

Price DECIMAL(10,2),

Model VARCHAR(255),

Year_of_manufacturing INT,

Fuel_Type VARCHAR(255)

);

CREATE TABLE CUSTOMER (

Customer_ID INT PRIMARY KEY,

Name VARCHAR(255),
Address VARCHAR(255),

Phone_Number VARCHAR(20),

Email VARCHAR(255)

);

CREATE TABLE SALE (

Invoice_Number INT PRIMARY KEY,

Car_ID INT,

Customer_ID INT,

Sale_Date DATE,

Mode_of_payment VARCHAR(255),

Sales_Person_Employee_ID INT,

Selling_Price DECIMAL(10,2),

FOREIGN KEY (Car_ID) REFERENCES INVENTORY(Car_ID),

FOREIGN KEY (Customer_ID) REFERENCES CUSTOMER(Customer_ID),

FOREIGN KEY (Sales_Person_Employee_ID) REFERENCES EMPLOYEE(Employee_ID)

);

CREATE TABLE EMPLOYEE (

Employee_ID INT PRIMARY KEY,

Name VARCHAR(255),

Date_of_birth DATE,

Date_of_joining DATE,

Designation VARCHAR(255),

Salary DECIMAL(10,2)

);

You might also like