-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdb.sql
More file actions
85 lines (68 loc) · 1.94 KB
/
db.sql
File metadata and controls
85 lines (68 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
drop database food_ordering;
create database food_ordering;
use food_ordering;
CREATE TABLE
Customers (
CustomerID INT AUTO_INCREMENT PRIMARY KEY,
Phone VARCHAR(20) NOT NULL,
Name VARCHAR(100) NOT NULL
);
CREATE TABLE
MenuItems (
MenuItemID INT AUTO_INCREMENT PRIMARY KEY,
Name VARCHAR(100) NOT NULL,
Price DECIMAL(10, 2) NOT NULL,
ImageUrl varchar(255) default null
);
Create table
Tables(
TableID int auto_increment primary key,
Status enum(
'Available',
'NotAvailable',
'Booked'
) not null
);
CREATE TABLE
Reservations (
ReservationID INT AUTO_INCREMENT PRIMARY KEY,
CustomerID INT,
TableID INT,
ReservationTime DATETIME NOT NULL,
Status ENUM(
'Accepted',
'Rejected',
'Pending'
) NOT NULL,
FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID),
Foreign key (TableID) References Tables(TableID)
);
CREATE TABLE
Orders (
OrderID INT AUTO_INCREMENT PRIMARY KEY,
ReservationID INT,
MenuItemID INT,
Quantity INT NOT NULL,
FOREIGN KEY (ReservationID) REFERENCES Reservations(ReservationID),
FOREIGN KEY (MenuItemID) REFERENCES MenuItems(MenuItemID)
);
CREATE TABLE
Payments (
PaymentID INT AUTO_INCREMENT PRIMARY KEY,
ReservationID INT,
Amount DECIMAL(10, 2) NOT NULL,
FOREIGN KEY (ReservationID) REFERENCES Reservations(ReservationID)
);
CREATE TABLE
Employees (
EmployeeID INT AUTO_INCREMENT PRIMARY KEY,
Username VARCHAR(50) NOT NULL,
Password VARCHAR(100) NOT NULL,
Role ENUM('Employee', 'Admin') NOT NULL
);
CREATE TABLE
Revenues (
RevenueID INT AUTO_INCREMENT PRIMARY KEY,
Date DATE NOT NULL,
Amount DECIMAL(10, 2) NOT NULL
);