0% found this document useful (0 votes)
3 views

CARSHOWROOM database

The document outlines the creation of a CARSHOWROOM database with four tables: INVENTORY, CUSTOMER, SALE, and EMPLOYEE. Each table has specific fields, including primary keys and foreign key relationships to ensure data integrity. The INVENTORY table tracks car details, CUSTOMER holds customer information, SALE records transactions, and EMPLOYEE contains employee details.

Uploaded by

cshinde000
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)
3 views

CARSHOWROOM database

The document outlines the creation of a CARSHOWROOM database with four tables: INVENTORY, CUSTOMER, SALE, and EMPLOYEE. Each table has specific fields, including primary keys and foreign key relationships to ensure data integrity. The INVENTORY table tracks car details, CUSTOMER holds customer information, SALE records transactions, and EMPLOYEE contains employee details.

Uploaded by

cshinde000
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 the CARSHOWROOM database

CREATE DATABASE CARSHOWROOM;

-- Use the CARSHOWROOM database

USE CARSHOWROOM;

-- Create the INVENTORY table

CREATE TABLE INVENTORY (

car_id INT PRIMARY KEY AUTO_INCREMENT,

name VARCHAR(100) NOT NULL,

price DECIMAL(10, 2) NOT NULL,

model VARCHAR(50),

year_of_manufacturing INT,

fuel_type VARCHAR(50)

);

-- Create the CUSTOMER table

CREATE TABLE CUSTOMER (

customer_id INT PRIMARY KEY AUTO_INCREMENT,

name VARCHAR(100) NOT NULL,

address VARCHAR(200),

phone_number VARCHAR(20),

email VARCHAR(100)

);

-- Create the SALE table

CREATE TABLE SALE (

invoice_number INT PRIMARY KEY AUTO_INCREMENT,

car_id INT,

customer_id INT,

sale_date DATE,
mode_of_payment VARCHAR(50),

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 (employee_id) REFERENCES EMPLOYEE(employee_id)

);

-- Create the EMPLOYEE table

CREATE TABLE EMPLOYEE (

employee_id INT PRIMARY KEY AUTO_INCREMENT,

name VARCHAR(100) NOT NULL,

date_of_birth DATE,

date_of_joining DATE,

designation VARCHAR(100),

salary DECIMAL(10, 2)

);

You might also like