Notifications:- Order Notifications: Send notifications to users to confirm orders, provideupdates on order status, and notify them of delivery.... It’ll help us understand how online pl
Trang 1VIETNAM NATIONAL UNIVERSITY – HCM
INTERNATIONAL UNIVERSITY
SEMESTER 2 (2023-2024)
FINAL PROJECTCourse: Principles of Database Management
Project name: Food Delivery ApplicationDate: 06/05/2024
Team members:Nguyễn Đăng Khôi - ITCSIU22073
Phan Minh Ân - ITCSIU22006Đoàn Phú Bình - ITCSIU22020Nguyễn Huy Hoàng - ITCSIU21061
Trang 21 Project Timeline and Milestones
2 Roles & Responsibilities
b Database and Tables Creation
c Database Data Insertion
Trang 3I - Introduction1 Abstract
- The primary purpose of this application is to establish a connection betweenrestaurants and consumers Restaurant owners will have the capability toregister and showcase their food items along with their respective prices Userswill also have the ability to register, explore nearby restaurants, and place ordersfor food items from their preferred restaurants Once an order is placed, therestaurant will accept it and assign a delivery person to fulfill the order Theuser who placed the order will be able to view the location of the deliveryperson and the estimated time of arrival for their food Furthermore, the cart andpayment page will have a distinct design that remains consistent throughout theentire application.
Trang 4- Modifiers: Handle optional add-ons or customizations for menu items (e.g.,toppings, sides).
f Feedback and Ratings:
- Customer Feedback: Enable users to leave reviews and ratings for orders andrestaurants.
- Rating Aggregation: Calculate and display aggregate ratings for restaurantsbased on user feedback.
g Notifications:
- Order Notifications: Send notifications to users to confirm orders, provideupdates on order status, and notify them of delivery.
Trang 5- Promotional Notifications: Send promotional messages or discounts to usersvia email or push notifications.
3 Goal
- Using DBMS for a food delivery application will give us extensive experiencein this technology It’ll help us understand how online platforms use andinteract with databases.
- Showcasing our knowledge of database management solutions while solving asignificant field of the modern economy.
- Our developed DBMS-based solution would allow restaurants to save a lot oftime and resources; moreover, the user could see all the food information fromone menu and order it accordingly on a user-friendly interface.
4 The Techniques & Tool Used
- Database: Microsoft SQL Server + SQL Server Management Studio 20- Java: IntelliJ IDEA Community Edition 2023.2.2
Trang 6II - Project Planning
1 Project Timeline and Milestones
Planning Organizing andselecting theproject topic
Research othersimilarapplications
the project
Design relationalmodels
Khoi
Trang 7Data insertion An, BinhData queries An, Binh
Interface review All
2 Roles & Responsibilities
Phan Minh Ân Database Developer,Interface Developer
Trang 84 Risk Assessment
- Inefficiency of communication:
+ Mismatched use of communication tools.+ Failure to provide timely updates or feedback.+ Unfamiliar with the use of progress tracking platforms.
- Technological Challenges (Data Management System): Limited experience orexposure to web development and project management.
III - Project Analysis1 Requirement Analysis
a Description of Project Requirements
- The project includes secure account login, password reset It will provide a listof products, restaurants Users can find and order a product from there.
b User Stories
- Customers:
+ Browse a list of products and choose a product that they want.
+ Search for restaurants and view their detailed information (ratings,reviews, …) to pick the best decision.
+ Add products to their cart.
+ View the status of my order (confirmation, preparation, delivery, …) toknow when to receive the order.
- Restaurants:
+ Receive orders from customers.
+ Manage the menu, update status of each product.+ Communicate with delivery personnel.
+ Access to customer ratings, reviews.
Trang 9- Deliverer:
+ Receive the order and customer’s information.
+ Have a map to find the best route to the customer’s location.
2 Approach Analysisa Review Materials
- Advanced SQL Server Language Structure.- Java Swing.
b Research Analysis
- During the development of the online food application, we have analyzedseveral aspects:
+ Users: Who the users are, and what food cuisine they like.
+ Application: The application must be family-friendly and easily usable bypeople from different generations.
+ Product: Includes category.+ Advertising.
+ Methodology.
3 System Analysisa Database Design
- ER diagram design:
Trang 10Figure 1 ER diagram for the online food application
- Schema design using the SQL server:
+ Navigate to the “Database Diagrams” folder in the Food database.+ Right-click the folder and choose “New Database Diagram”.+ Add all the tables in the Food database.
+ To create a relationship, click the PK of a table and hold, drag the mouseto the FK of another table.
Trang 11Figure 2 Schema design
- Our database has achieved the Boyce-Codd Normal Form (BCNF) because ofthe requirements:
+ First Normal Form (1NF): Each relation does not have any multivaluedtuples.
+ Second Normal Form (2NF): Each relation is in 1NF and all non-keyattributes are functionally dependent on the primary key.
+ Third Normal Form (3NF): Each relation is in 2NF and no transitivedependencies between non-key attributes exist.
+ Boyce-Codd Normal Form (BCNF): Stronger than 3NF.b Database and Tables Creation
- From the ER diagram, this part will show how to create the database, schemasand tables using the Microsoft SQL Server Management Studio 20.
Trang 12Figure 3 Database structure
- Add a line to move to the database:USE Food
● Schemas and Tables Creation
- Based on the ER diagram, we have a total of 6 entities:
Username varchar(50) NOT NULL,Email varchar(50) NOT NULL,Pass varchar(50) NOT NULL,Dob date NOT NULL,
PhoneNo varchar(20) NOT NULL,Addr varchar(50) NOT NULL,Wallet int NULL,
Paymentid int NOT NULL FOREIGN KEY REFERENCES Payment(PaymentID)CREATE TABLE [Restaurant] RestaurantID int NOT NULL PRIMARY KEY,
RestaurantName varchar(50) NOT NULL,RestaurantAddr varchar(50) NOT NULL,ContactNumber varchar(20) NOT NULL,
Trang 13CREATE TABLE [Product] ProductID int NOT NULL PRIMARY KEY,ProductName varchar(50) NOT NULL,Category varchar(50) NOT NULL,
ProductDescription varchar(500) NOT NULL,Price int NOT NULL,
Restaurantid int NOT NULL FOREIGN KEY REFERENCES Restaurant(RestaurantID)CREATE TABLE [Deliverer] DelivererID int NOT NULL PRIMARY KEY,
DelivererName varchar(50) NOT NULL, DelivererPhone varchar(20) NOT NULL
Userid int NOT NULL FOREIGN KEY REFERENCES [User](UserID),
Delivererid int NOT NULL FOREIGN KEY REFERENCES Deliverer(DelivererID),OrderDate date NOT NULL,
NumberProducts int NOT NULL,TotalPrice int NOT NULL
CREATE TABLE [Payment] PaymentID int NOT NULL PRIMARY KEY,PaymentName varchar(50) NOT NULL,PaymentType varchar(50) NOT NULLCREATE TABLE
OrderProduct Orderid INT NOT NULL FOREIGN KEY REFERENCES [Order](OrderID),Productid INT NOT NULL FOREIGN KEY REFERENCES Product(ProductID)
- The User, Deliverer tables store the information of a customer, a deliverer inthe application.
- The Restaurant table stores the information of restaurants that are available inthe application.
- The Product table stores the information, price of food or drinks.- The Order table tracks the number of products chosen by the user.- The Payment table stores what payment method a user uses.
c Database Data Insertion- For the … tables, we have
Trang 14- For the … tables,● User Table
INSERT INTO [User] (UserID, Paymentid, Username, Email, Pass, Dob, PhoneNo, Addr, Wallet)
Restaurant (RestaurantID, RestaurantName, RestaurantAddr, ContactNumber)VALUES
(1, 'Good Eats Cafe', '123 Main St, Cityville', '133-906-7290'), (2, 'Tasty Bites Restaurant', '456 Oak Ave, Townsville', '907-614-3112'), (3, 'Spicy Noodles Express', '789 Elm Rd, Village Town', '501-133-4173'), (4, 'Pizza Palace', '321 Pine Blvd, Subnautica', '123-999-0281');
(2, 1, 'French Fries', 'Side Dish', 'Crispy golden fries served with ketchup', 50),
(3, 2, 'Margherita Pizza', 'Pizza', 'Classic pizza topped with tomato sauce, mozzarella, and basil', 150),
(4, 2, 'Pasta Carbonara', 'Pasta', 'Creamy pasta with bacon, egg, and Parmesan cheese', 120),
(5, 3, 'Chicken Curry', 'Main Course', 'Spicy chicken curry served with rice', 180), (6, 3, 'Spring Rolls', 'Appetizer', 'Crispy vegetable spring rolls served with dipping sauce', 80),
(7, 4, 'Chocolate Cake', 'Dessert', 'Rich and moist chocolate cake topped with chocolate ganache', 200),
(8, 4, 'Salad', 'Side Dish', 'Fresh mixed greens with cherry tomatoes and balsamic dressing', 90);
● Deliverer TableINSERT INTO
Deliverer (DelivererID, DelivererName, DelivererPhone)VALUES
(1, 'John Ash', '123-678-9101'), (2, 'Jane Dang', '987-494-7710'),
Trang 15(4, 'Sarah Brack’, '797-808-9289');● Order Table
INSERT INTO
Order (OrderID, Userid, Productid, Delivererid, OrderDate, NumberProducts, TotalPrice)VALUES
(1, , 1, 1, '2024-05-01', 1, 100),1 (2, , 3, 2, '2024-05-02', 2, 300),2 (3, , 6, 3, '2024-05-03', 1, 80),3 (4, , 7, 4, '2024-05-04', 1, 200);4
d Database Queries
- Here are some queries and their functions that we have used for the project:
DROP DATABASE Commerce;
CREATE DATABASE Commerce;
CREATE TABLE table_name ( column1 datatype, column2 datatype,
column1 datatype NOT NULL,
specify which column does not accept the null value when we insert a
Trang 16);
value(row) in a table
CREATE TABLE table_name ( column1 datatype UNIQUE, column2 datatype,
The constraint PRIMARY KEY
suggests that entries should be neithernull nor duplicate corresponding to the specified column
CREATE TABLE Customer(Customer_ID intNOT NULL,CONSTRAINT
Customer_Customer_ID_fk FOREIGN KEY(Customer_ID) REFERENCES Account(ID));
The FOREIGN KEY is used to build a connection between the current table and the previous table containing the primary key
SELECT column1, column2, FROM table_name
ORDER BY column1, column2, ASC|DESC;
TheORDER BY keyword is used to
show the result in ascending or descending order By default, it is in ascending order
SELECT COUNT(Customer_ID) FROM
Customer GROUP BY Customer_ID; The GROUP BY keyword is used for grouping the results
SELECT column_name(s)FROM table1
INNER JOIN table2ON table1.column_name = table2.column_name;
The INNER JOIN keyword returns
all matching records from both the table
SELECT column1, column2, FROM table_name
The HAVING clause is similar to the
WHERE clause However, the HAVING clause is used to filter
Trang 17HAVING condition;
grouped rows instead of single rows These rows are grouped together by the GROUP BY clause, so, the
HAVING clause must always be
followed by the GROUP BY clauseUPDATE view_name
SET column1 = value1, column2 =value2 , columnN = valueNWHERE [condition];
The UPDATE statement makes use of locks on each row while modifying them in a table, and once the row is modified, the lock is releasedWhere [condition1] AND
The AND returns true or , if both its 1
operands evaluates to true We can use it to combine two conditions in the
WHERE clause of an SQL statement.
DELETE FROM table_name WHERE [condition];
The DELETE Statement is used to delete the records from an existing table In order to filter the records to bedeleted (or, delete particular records), we need to use the WHERE clause along with the DELETE statement
Trang 18b Connection Implementation
- Java code to connect to the SQL Server:
import com.microsoft.sqlserver.jdbc.SQLServerDataSource;import com.microsoft.sqlserver.jdbc.SQLServerException;
Trang 19import java.sql.SQLException;
public class TestConnection {
public static void main(String[] args) {
SQLServerDataSource ds = new SQLServerDataSource(); ds.setUser("sa");
} catch (SQLException throwables) { throwables.printStackTrace(); }
}}
- Result:
c GUI & Buttons Design● Login Screen
Trang 20- In this phase, the users enter their account and password in order to gainaccess to the application
● Register Screen
Trang 21- If the users do not have an account available, they can register a new accountusing their Email and Phone number.
● User Screen
Trang 22- The user screen allows users to view and manage their personal information.
● Order Screen
Trang 23- This window allows you to enter the details of a product you want to add toyour order, including the type of deliverer and the total price
● Product Screen
Trang 24- In this window, we have more accurate information about the productsincluding names, quantities and prices we are about to buy.
● Deliverer Screen
Trang 25- This window displays the details of the delivery driver who will take the order,including their name and phone number for contact purposes.
Trang 26IV Conclusion
In conclusion, the development of a robust and scalable food deliveryapplication requires meticulous planning and execution across various technicaland operational facets By leveraging advanced database management systems,comprehensive menu and order management modules, secure userauthentication processes, and real-time delivery tracking, we can create aseamless and efficient experience for users, restaurant partners, and deliverypersonnel
The integration of analytics and reporting tools will enable continuousimprovement and adaptability in a dynamic market, while adherence to datasecurity and compliance standards will ensure the protection of userinformation As we move forward, the focus should remain on innovation, usersatisfaction, and operational excellence to sustain and grow the application’ssuccess in the competitive food delivery landscape.
By prioritizing these elements, we not only meet current market demands butalso pave the way for future advancements and enhancements, ensuring ourfood delivery application remains at the forefront of the industry.