Database Redesign Project
Author: Oscar Simeon
Date: 2024-10-16
This project focuses on the redesign of a relational database schema for a restaurant’s core operations — including table bookings, food orders, menu and staff management, and customer payments.
The redesigned schema introduces normalized structures, enforces data integrity using constraints, and supports real-time tracking and reporting.
UNIQUE
,
DEFAULT
, and ENUM
Feature | Old Schema | New Schema | Purpose |
---|---|---|---|
Table Naming | Tbl_order , menu_item |
TABLE ORDER , MENUITEM |
Standardized & descriptive |
Shift Field | Free text shift |
ENUM('MORNING', 'EVENING', 'FULL') |
➤ Prevents invalid input |
Order/Menu Link | ORDERMENUITEM(order_id) |
Composite PK: ORDER ID , MENUITEM ID |
Enables multiple items per order |
Price Field | FLOAT |
DECIMAL(8,2) |
➤ Improves currency precision |
Status Tracking | Not available | Fields like ORDER STATUS ,
RESERVATION STATUS , PAYMENT STATUS |
Enables real-time system state |
Timestamps | Missing | CREATED_AT , UPDATED_AT |
➤ Supports audit trails and analysis |
TABLE
: Represents physical tables.
Linked to TABLE ORDER
and RESERVATION
.WAITER
: Staff member handling orders;
has SHIFT
and CONTACT NO
.TABLE ORDER
: Stores orders placed at a
table, linked to a WAITER
.CUSTOMER
: Holds customer data with
unique NIC NO
.MENU
: Categorizes menu offerings
(e.g., Breakfast, Lunch).MENUITEM
: Individual items (e.g.,
“Pancakes”, “Rice”). Linked to a MENU
.ORDER MENUITEM
: A junction table
linking orders with items and QUANTITY
.RESERVATION
: Holds reservation details
with links to TABLE
, CUSTOMER
, and optionally
ORDER
.PAYMENT
: Stores payment method,
amount, status, and timestamps for orders.ENUM
fields (e.g.,
SHIFT
, ORDER STATUS
,
PAYMENT METHOD
) reduces errors by enforcing valid input
values.ORDER MENUITEM
enables flexible, multi-item orders.DECIMAL(8,2)
used instead of FLOAT
for
accurate currency storage.RESERVATION STATUS
,
PAYMENT STATUS
) support live tracking and better
analytics.CREATED_AT
,
UPDATED_AT
) allow historical tracking and audit
trails.CREATE TABLE `ORDER MENUITEM` (
`ORDER ID` INT,
`MENUITEM ID` INT,
QUANTITY INT,
PRIMARY KEY (`ORDER ID`, `MENUITEM ID`),
FOREIGN KEY (`ORDER ID`) REFERENCES `TABLE ORDER`(`ORDER ID`),
FOREIGN KEY (`MENUITEM ID`) REFERENCES MENUITEM(`MENUITEM ID`)
);