100% found this document useful (2 votes)
1K views

Assignment 9

The document describes the creation of a database called CARSHOWROOM to store information about a car showroom. The database contains 4 tables - INVENTORY to store car details, CUSTOMER for customer information, SALE to record car sales transactions, and EMPLOYEE for employee data. Field definitions and primary/foreign keys are provided for each table.

Uploaded by

Madhu
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
100% found this document useful (2 votes)
1K views

Assignment 9

The document describes the creation of a database called CARSHOWROOM to store information about a car showroom. The database contains 4 tables - INVENTORY to store car details, CUSTOMER for customer information, SALE to record car sales transactions, and EMPLOYEE for employee data. Field definitions and primary/foreign keys are provided for each table.

Uploaded by

Madhu
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
You are on page 1/ 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