My SQL code
-- Create the database
CREATE DATABASE RestaurantDB;
-- Use the created database
USE RestaurantDB;
-- Table for menu items
CREATE TABLE Menu (
item_id INT AUTO_INCREMENT PRIMARY KEY,
item_name VARCHAR(100) NOT NULL,
price DECIMAL(10, 2) NOT NULL,
category VARCHAR(50) NOT NULL
);
-- Table for orders
CREATE TABLE Orders (
order_id INT AUTO_INCREMENT PRIMARY KEY,
table_number INT NOT NULL,
order_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Table for order details
CREATE TABLE OrderDetails (
detail_id INT AUTO_INCREMENT PRIMARY KEY,
order_id INT NOT NULL,
item_id INT NOT NULL,
quantity INT NOT NULL,
FOREIGN KEY (order_id) REFERENCES Orders(order_id) ON
DELETE CASCADE,
FOREIGN KEY (item_id) REFERENCES Menu(item_id) ON
DELETE CASCADE
);
-- Table for inventory
CREATE TABLE Inventory (
item_id INT PRIMARY KEY,
stock INT NOT NULL,
FOREIGN KEY (item_id) REFERENCES Menu(item_id) ON
DELETE CASCADE
);
-- Table for customers
CREATE TABLE Customers (
customer_id INT AUTO_INCREMENT PRIMARY KEY,
customer_name VARCHAR(100) NOT NULL,
customer_phone VARCHAR(15) NOT NULL
);
-- Table for employees
CREATE TABLE Employees (
employee_id INT AUTO_INCREMENT PRIMARY KEY,
employee_name VARCHAR(100) NOT NULL,
employee_position VARCHAR(50) NOT NULL,
salary DECIMAL(10, 2) NOT NULL
);
-- Table for reservations
CREATE TABLE Reservations (
reservation_id INT AUTO_INCREMENT PRIMARY KEY,
customer_id INT NOT NULL,
reservation_date DATETIME NOT NULL,
table_number INT NOT NULL,
number_of_people INT NOT NULL,
FOREIGN KEY (customer_id) REFERENCES
Customers(customer_id) ON DELETE CASCADE
);
Group members
Dilshad Alam
Rishi Verma
Shivam Prakash