Database project
Database project
Project Title:
Objective:
To create a centralized and efficient system that manages food orders online, tracks real-time
customer orders, maintains restaurant data, and ensures smooth transactions between customers
and restaurants.
�Core Modules
Key Tables:
�Benefits
�Project Objective
The main objective of the Online Food Ordering Database Management System in Injibara
university is to design and implement a robust, efficient, and user-friendly system that
manages the end-to-end process of online food ordering—streamlining the operations for
students, cafteria managers, and system administrators through an integrated database-driven
platform.
�Specific Goals
Project Objective
The main objective of the Online Food Ordering Database Management System is to design and
implement a robust, efficient, and user-friendly system that manages the end-to-end process of online
food ordering—streamlining the operations for customers, restaurant managers, and system
administrators through an integrated database-driven platform.
�Specific Goals
Would you like a sample project abstract or documentation template for submission?
4o
The significance of an Online Food Ordering Database Management System project in a university
setting goes beyond just building a functional application—it plays a key role in academic development,
skill-building, and real-world application. Here's a breakdown:
Covers the complete SDLC (Software Development Life Cycle): planning, designing,
implementing, testing, and deployment.
Teaches how databases interact with frontend and backend logic.
Often developed in groups, the project fosters teamwork, communication, and version control
using tools like Git.
Simulates real industry environments.
Involves solving real-world problems like data inconsistency, user authentication, concurrent
access, and secure transactions.
Acts as a strong portfolio project for job or internship applications in software development,
web development, or data management.
Demonstrates practical skills to potential employers.
Encourages students to think about business logic, user experience, and market needs—which
can be a foundation for startups or freelance work.
Builds a solid foundation for more complex final-year projects involving e-commerce, AI-driven
recommendation systems, or cloud-based applications.
In summary, this project is significant because it bridges academic knowledge and real-world
application, equipping students with both technical and soft skills needed in the industry.
Feasibility Study
1. Technical Feasibility
1. User Management
Database Tables:
Users, Roles
Tools:
Database Tables:
Restaurants, Menu_Items, Categories
Tools:
DBMS: MySQL
UI: HTML/CSS, Bootstrap
CRUD Interfaces: PHPMyAdmin, custom admin panel
3. Order Management
Database Tables:
Orders, Order_Details, Order_Status, Users, Menu_Items
Tools:
4. Payment Handling
Database Tables:
Payments, Orders
Tools:
Tools:
Admin can view reports: total users, total sales, order trends.
Generate summaries using aggregate queries.
Database Tables:
Users, Orders, Payments, Menu_Items
Tools:
7. Security Functions
Database Features:
Tools:
Layer Tools/Technologies
Would you like a sample schema or ER diagram that aligns with these functional requirements?
4o
�Non-Functional Requirements
These requirements ensure the system responds efficiently under expected workloads.
Query Optimization:
o SQL queries must be optimized to retrieve data with minimal delay (e.g., using indexes
on UserID, OrderID, RestaurantID).
Response Time:
o The system should respond to user queries (e.g., order status, menu listings) within 2–
3 seconds under normal load.
Concurrent Access:
o The database should support multiple users placing orders simultaneously without
conflict or data loss (use of transaction management or isolation levels).
Scalability (Academic-Level):
o Though a small-scale project, the system should be designed to handle hundreds of
records and allow for easy future expansion.
These ensure the system is easy to use, understand, and navigate, especially by non-technical users.
These focus on protecting the database and user data from unauthorized access or misuse.
�Summary Table
Category Requirement
1. User
o UserID (PK)
o Name
o Email
o Password
o Phone
o Role (Customer, Restaurant, Admin)
2. Restaurant
o RestaurantID (PK)
o UserID (FK from User)
o RestaurantName
o Address
o Phone
o Status (Approved, Pending)
3. MenuItem
o ItemID (PK)
o RestaurantID (FK)
o ItemName
o Description
o Price
o Category
4. Order
o OrderID (PK)
o UserID (FK from User - customer)
o RestaurantID (FK)
o OrderDate
o TotalAmount
o Status (Placed, Confirmed, Delivered, Canceled)
5. OrderDetail
o OrderDetailID (PK)
o OrderID (FK)
o ItemID (FK)
o Quantity
o Subtotal
6. Payment
o PaymentID (PK)
o OrderID (FK)
o Amount
o PaymentDate
o PaymentMethod (COD, Online)
o PaymentStatus
7. Review
o ReviewID (PK)
o UserID (FK)
o RestaurantID (FK)
o Rating (1–5)
o Comment
o ReviewDate
�Relationships Overview
User —< Restaurant: One user (restaurant owner) can manage one or more restaurants.
Restaurant —< MenuItem: One restaurant can offer many menu items.
User —< Order: One user (customer) can place many orders.
Restaurant —< Order: One restaurant can receive many orders.
Order —< OrderDetail >— MenuItem: Many-to-many between orders and menu items, with
quantities and prices.
Order — Payment: One order has one payment record.
User —< Review >— Restaurant: Many-to-many, one customer can review many restaurants.
[User]───<owns>───[Restaurant]───<offers>───[MenuItem]
│ │
<places> <receives>
│ │
[Order]───<contains>───[OrderDetail]───<refers to>───[MenuItem]
│
<pays>
│
[Payment]
[User]───<writes>───[Review]───<about>───[Restaurant]
�What is Normalization?
Below are the steps taken to normalize the schema to Third Normal Form (3NF):
Rule:
Each column should contain atomic (indivisible) values. No repeating groups or arrays.
diff
CopyEdit
OrderID | CustomerName | OrderedItems
------- | ------------ | ---------------------
101 | John Doe | Burger, Fries, Coke
Normalized to 1NF:
diff
CopyEdit
OrderID | CustomerName | OrderedItem
------- | ------------ | ------------
101 | John Doe | Burger
101 | John Doe | Fries
101 | John Doe | Coke
Rule:
All non-key attributes must depend on the entire primary key.
Example Violation:
In a table OrderDetails(OrderID, ItemID, ItemName, Quantity)
ItemName depends only on ItemID, not the full composite key.
Fix:
Rule:
No non-key attribute should depend on another non-key attribute.
Example Violation:
In Users(UserID, Email, Password, RoleName)
RoleName is not dependent on UserID, but on a missing RoleID.
Fix:
�Summary of Benefits
1. Users Table
sql
CREATE TABLE Users (
UserID INT PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR(100) NOT NULL,
Email VARCHAR(100) UNIQUE NOT NULL,
PasswordHash VARCHAR(255) NOT NULL,
Phone VARCHAR(20),
RoleID INT,
FOREIGN KEY (RoleID) REFERENCES Roles(RoleID)
);
2. Roles Table
Sql
3. Restaurants Table
sql
5. Orders Table
sql
6. OrderDetails Table
sql
7. Payments Table
sql
8. Reviews Table
Sql
�Notes on Constraints
�Why MySQL?
sql
CopyEdit
CREATE DATABASE OnlineFoodOrdering;
USE OnlineFoodOrdering;
Execute SQL scripts to create normalized tables (Users, Orders, MenuItems, etc.)
Apply primary keys, foreign keys, CHECK constraints
sql
CopyEdit
INSERT INTO Roles (RoleName) VALUES ('Customer'), ('Admin'), ('Restaurant');
INSERT INTO Users (Name, Email, PasswordHash, RoleID) VALUES (...);
Ensure Insert, Update, Delete, and Read work properly across tables
Use JOINs to combine data (e.g., Orders with MenuItems)
sql
CopyEdit
CREATE VIEW CustomerOrderSummary AS
SELECT Users.Name, Orders.OrderID, Orders.TotalAmount
FROM Users
JOIN Orders ON Users.UserID = Orders.CustomerID;
sql
CopyEdit
GRANT SELECT, INSERT ON OnlineFoodOrdering.* TO 'webappuser'@'localhost';
Here’s a comprehensive Data Insertion section for the implementation step of your Online Food
Ordering Database Management System (OFODMS) project, suitable for a university-level database
systems course. It includes sample data sets used for testing and demonstration purposes.
�Purpose:
Populate the database with realistic test data
Validate relationships, constraints, and queries
Demonstrate system functionality (CRUD, reports, etc.)
1. Roles Table
sql
2. Users Table
sql
3. Restaurants Table
sql
4. MenuItems Table
sql
5. Orders Table
sql
6. OrderDetails Table
sql
7. Payments Table
Sql
8. Reviews Table
sql
sql
CopyEdit
SELECT ItemID, ItemName, Price, Category
FROM MenuItems
WHERE RestaurantID = 1;
b) Display order history for a specific customer
sql
CopyEdit
SELECT Orders.OrderID, Orders.OrderDate, Orders.TotalAmount, Orders.Status
FROM Orders
JOIN Users ON Orders.CustomerID = Users.UserID
WHERE Users.Email = '[email protected]';
sql
CopyEdit
SELECT MenuItems.ItemName, OrderDetails.Quantity, OrderDetails.Subtotal
FROM OrderDetails
JOIN MenuItems ON OrderDetails.ItemID = MenuItems.ItemID
WHERE OrderDetails.OrderID = 1;
sql
CopyEdit
SELECT Restaurants.RestaurantName, AVG(Reviews.Rating) AS AverageRating
FROM Reviews
JOIN Restaurants ON Reviews.RestaurantID = Restaurants.RestaurantID
GROUP BY Restaurants.RestaurantName;
sql
CopyEdit
INSERT INTO Users (Name, Email, PasswordHash, Phone, RoleID)
VALUES ('Emily Eats', '[email protected]', 'hashedpassword', '999-888-7777',
2);
sql
CopyEdit
INSERT INTO MenuItems (RestaurantID, ItemName, Description, Price, Category)
VALUES (1, 'Veggie Wrap', 'Fresh vegetables in a tortilla wrap', 4.99, 'Main
Course');
sql
CopyEdit
-- Insert Order
INSERT INTO Orders (CustomerID, RestaurantID, OrderDate, TotalAmount, Status)
VALUES (2, 1, NOW(), 9.98, 'Placed');
sql
CopyEdit
UPDATE Orders
SET Status = 'Delivered'
WHERE OrderID = 1;
sql
CopyEdit
UPDATE MenuItems
SET Price = 6.99
WHERE ItemName = 'Cheese Burger' AND RestaurantID = 1;
sql
CopyEdit
DELETE FROM Users
WHERE Email = '[email protected]' AND RoleID = 2;
sql
CopyEdit
DELETE FROM MenuItems
WHERE ItemID = 4 AND RestaurantID = 1;
Phase: Implementation
Context: University-Level DBMS Project
DBMS: MySQL (compatible with PostgreSQL/SQL Server with slight syntax changes)
sql
CopyEdit
DELIMITER $$
-- Calculate total
SET orderTotal = (price1 * p_Quantity1) + (price2 * p_Quantity2);
DELIMITER ;
sql
CopyEdit
DELIMITER $$
DELIMITER ;
sql
CopyEdit
DELIMITER $$
DELIMITER ;
�4. Stored Procedure: Update Order Status
sql
CopyEdit
DELIMITER $$
DELIMITER ;
�Benefits in Implementation
Procedure/Function Purpose
Would you like me to provide a .sql export of these procedures/functions or help you integrate them
into a front-end app?