0% found this document useful (0 votes)
56 views37 pages

Online Food-Ordering System: Group Member1 V.Sriram (19BCE0934) Group Member2 S.Sai Lokesh (19BCE2379)

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 37

Online food-ordering system

REVIEW REPORT
Submitted by

Group Member1 V.Sriram (19BCE0934)


Group Member2 S.Sai lokesh (19BCE2379)

Prepared For

DATABASE MANAGEMENT SYSTEM (CSE2004)

PROJECT COMPONENT

Submitted To

Dr.Karthikeyan

Associate Professor
Abstract:
The food business is already very profitable and expanding it online will turn out to
be more beneficial for a restaurant. This online food ordering website enables us to order
various foods and beverages from the restaurant without having to step out of our houses.
Using internet we can just order and it will delivered to the location we input. This also
provides the restaurant to be more flexible and to increase their number of customers. The
customers can simply register themselves in the website and then a user id will be
generated for them which will be unique. After that they can login and go through the Menu
, read the description of the various food items and then make their order. Online Food
Ordering System could be a part of e-commerce. E-commerce or business through web
suggests that distributing, buying, selling, marketing, and coupling of product or services
over electronic systems like the net and alternative pc networks. Internet has seen an
amazing growth in terms of coverage and awareness. So giving the business a web presence
has become terribly crucial and vital. With Online Ordering System we are able to: discover
we have a tendency to building menu on-line and also the customers can simply place order
with a straightforward depression. conjointly with a food menu on-line we are able to
simply track the orders, maintain customer's info and improve the food delivery service.

Introduction:
The Online Ordering System will be outlined as a straightforward and convenient
approach for patrons to buy food on-line, while not having to travel to the edifice. This
system is enabled by the net – it's the net that connects the edifice or the company on
one hand, and therefore the client on alternative hand. Therefore, as per this system,
the customer visits the restaurant’s app or website, browses through the various food
items, combos and cuisines available there and goes ahead and selects and purchases
the items he or she needs. These items will then be delivered to the customer at his or
her doorstep at the time they choose by a delivery person. Payments for such online
orders can be made through debit cards, credit cards, cash or card on delivery, or even
through digital wallets. This system for on-line food delivery is totally safe, secure and
may be a very hip technique that's revolutionizing the approach during which the food
trade operates.

Objective:
The main objective of this project is to develop an application which gives provision to
the restaurant owners to flourish their business by uploading menus at no cost and will
invariably lead to higher customer retention and acquisition rates. Reduce time-consuming
phone orders and eliminate illegible fax orders. No more busy phones or the requirement
for extra phone lines. An edge over the competition at an affordable price. Broader
customer reach across regions. Builds a customer database. Provides a channel for
marketing and promotion lowering your advertising cost.Helps in improved service.Greater
customer satisfaction!!

ER-Diagram:
Relational Mapping:

Normalisation

Normalization Of Customer Entity:


Conversion of customer entity into 1NF:
Conditions:
1.all the attributes should be atomic(name)
2.a column should contain values of same domain
3.each column should have unique values(phone number)

Conversion of above first Normal form to second normal form:


Condition:
1.it should already be in 1NF.
2.No partial dependence Functional dependence:
Customer ID→ customer ID, Email, First name, Middle name, Last name, Postal code, State,
District, Colony, Street, House number, Password
(first name)(middle name)(last name) →customer ID, Email, First name, Middle name, Last
name,Postal code, State, District, Colony, Street, House number, Password
Email →customer ID, Email, First name, Middle name, Last name, Postal code, State,
District, Colony, Street, House number,Password
Postal code →postal code ,state ,district

The tables are already in 3NF and BCNF.


Normalization of order entity:

Normalization of Delivery boy:

Conversion of delivery boy entity into 1NF: All attributes should have atomic values and
unique values.
Conversion into 2NF:
Candidate key: Emp_id
Check whether the LHS is a proper subset of some candidate key or the RHS are not all key
attributes
Functional dependicies we get are:
Emp_id→Order_id
Emp_id→Emp_name, D.Ph.no, Departure_Time ,Arrival_Time
Conversion into 3NF:
Candidate key: Emp_id
Check whether the LHS is superkey or the RHS are all key attributes
Functional dependicies we get are:
Emp_id→Order_id
Emp_id→Emp_name, D.Ph.no, Departure_Time ,Arrival_Time
Conversion into BCNF: A table is in BCNF if and only if for every non-trivial FD, the LHS is a
superkey. Therefore, the table is already in BCNF.

Normalization for food entity:

Conversion of food entity into 1NF: All attributes should have atomic values and unique
values.

The table is already in BCNF.

Normalization for feedback entity:

Conversion into 1NF:


Candidate key-a
Functional dependencies:
a->bc
a->d
•The table is converted to 1NF – as 1 customer_id can have multiple feedback messages

Conversion into 2NF:


•Check whether LHS is a proper subset of candidate key or the RHS are not all key
attributes.
The table is in 2NF
Conversion into 3NF:
•Check whether LHS is a superkey or the RHS are all key attributes.
The table is in 3NF .
Conversion into BCNF:
• Check if and only if for every non-trivial FD, the LHS is a superkey.
The table s in bCNF.

Normalization of Payment entity:

The table is in 1NF.

Conversion into 2NF:


•Candidate keys-{ b,d,e,j,l,m,a}, { b,d,e,j,l,m,c}
•The table is not in 2NF- [b --> f] is a partial dependency
•Therefore the table is split into the following relations:
(b,f,g,h,i,k) with FDs: b --> f
f --> g,h,i,k (a,b,c,d,e,j,l,m), with FDs:a --> c ,c --> a
Conversion into 3NF:
•Checking (b,f,g,h,i,k), with FDs:b --> f, f --> g,h,i,k
•The table is not in 3NF, therefore the table is split into:
(f,g,h,i,k), with FDs:f --> g,h,i,k
(b,f), with FDs:b --> f
•The table is in 3NF (a,b,c,d,e,j,l,m), with FDs:a --> c, c --> a

Conversion into BCNF:


• FD [b --> f] violates BCNF as the LHS is not superkey.
• Table is split into : (b,f,g,h,i,k ), (a,b,d,e,j,l,m )
• • FD [f --> g,h,i,k] violates BCNF as the LHS is not superkey.
• Table is split into : (f,g,h,i,k ), (b,f )
3.Creation of tables:
CREATE TABLE Customer(

Cust_id varchar2(25) primary key,

Email varchar2(40) not null,

F_name varchar2(10) not null,

M_name varchar2(10),

L_name varchar2(10),

Password varchar2(20),

Postal_code number(6) not null,

Street varchar2(15) not null,

House_number varchar2(10) not null);

CREATE TABLE postal_code(

Postal_code number(6) primary key ,

Colony varchar2(20),

State varchar2(20) not null,

District varchar2(15) not null);


CREATE TABLE phone_number(

Cust_id varchar2(25) not null,

constraints ph1 foreign key(Cust_id) references Customer(Cust_id),Phone_number number(10) not


null);

CREATE TABLE Order1(

Order_id number(10) primary key not null,

Cust_id varchar2(25) not null,

constraints or1 foreign key(Cust_id) references Customer(Cust_id),

Food_item_id varchar2(10) not null,

Emp_id varchar2(10) not null,

Date_or date not null);

CREATE TABLE employee1(

Emp_id varchar2(10) primary key not null,

Order_id number(10) not null,


constraints em1 foreign key(Order_id) references Order1(Order_id));

CREATE TABLE employee2(

Emp_id varchar(10) primary key not null,

Emp_name char(20),

D_Ph_no number(12),

departure_time timestamp,

arrival_time timestamp);

CREATE TABLE food1(

Food_item_id varchar(5) primary key not null,

Order_id number(10) not null,


constraints food11 foreign key(Order_id) references Order1(Order_id));

CREATE TABLE food2(

Food_item_id varchar(5) primary key not null,

description varchar(200) not null,

veg char(20) not null,

non_veg char(20) not null,

beverages varchar(20),

status char(20) not null);

CREATE TABLE feedback1(

Feedback_id varchar2(10) primary key,

Order_id number(10) not null,

constraints feed1 foreign key(Order_id) references Order1(Order_id),


Cust_id varchar2(25) not null,

constraints feed2 foreign key(Cust_id) references Customer(Cust_id));

CREATE TABLE feedback2(

Feedback_id varchar2(20) primary key,

Feedback_msg varchar2(150));

CREATE TABLE payment1(

Cust_id varchar2(6) primary key,

constraints pay1 foreign key (Cust_id) references Customer(Cust_id),

Card_no number(15) not null);

CREATE TABLE payment2(


Payment_id varchar2(10) primary key,

Order_id number(10) not null,

constraints pay2 foreign key(Order_id) references Order1(Order_id));

CREATE TABLE payment3(

Card_no number(15) primary key,

Card_holder_name varchar2(30),

CVV number(3),

Exp_date varchar2(10),

Security_code number(6));

CREATE TABLE payment4(

Payment_id varchar2(10) primary key,

Cust_id varchar2(10) not null,

constraints pay41 foreign key(Cust_id) references Customer(Cust_id),

Payment_time timestamp,

Gross_amt number(10) not null,


Discount varchar2(10),

Pay_type varchar2(10) not null,

Total_amt number(10) not null);

INSERTING:

insert into Customer values('C1001','SRIRAM@YAHOO.COM','Sriram','


','Srivastava','NSHUA1234',632014,'3','34');

insert into Customer values('C1002','LOKESH@GOOGLE.COM','Lokesh','


','W','ASDF@167',530068,'4','46');

insert into Customer values('C1003','PALAK@YAHOO.COM','Palak','


','A','QWERT$623',400001,'1','28');

insert into Customer values('C1004','SUPREETH@GOOGLE.COM','Supreeth','


','D','ZXCC%%1',500079,'3','80');

insert into Customer values('C1005','BHAVYA@GMAIL.COM','Bhavya','


','Garg','QAZW@345',632014,'5','26');

insert into postal_code values(632014,'DASNAC','TAMIL NADU','VELLORE');


insert into postal_code values(400001,'GREEN FIELD COLONY','MAHARASHTRA','MUMBAI');

insert into postal_code values(500079,'NIL','TELANGANA','HYDERABAD');

insert into postal_code values(110001,'NIL','DELHI','DELHI');

insert into postal_code values(530068,'SEA BEACH APARTMENTS','BANGALORE','KARNATAKA');

insert into phone_number values('C1001',9874829342);

insert into phone_number values('C1001',1234567891);

insert into phone_number values('C1002',9876543211);

insert into phone_number values('C1003',2468014234);

insert into phone_number values('C1003',6789012345);

insert into phone_number values('C1004',1234567890);

insert into phone_number values('C1005',1234567888);

insert into Order1 values(0001,'C1001','F001','EMP001','12-apr-2020');

insert into Order1 values(0002,'C1002','F002','EMP002','07-aug-2020');

insert into Order1 values(0003,'C1003','F003','EMP003','31-jan-2020');

insert into Order1 values(0004,'C1004','F004','EMP004','07-jan-2020');


insert into Order1 values(0005,'C1005','F005','EMP005','08-apr-2020');

insert into employee1 values('EMP001', '0001');

insert into employee1 values('EMP002', '0002');

insert into employee1 values('EMP003', '0003');

insert into employee1 values('EMP004','0004');

insert into employee1 values ('EMP005','0005');

insert into employee2 values ('EMP001', 'Shaan Javeri',9876543210, '13-sep-2020 03:21:09', ' 13-
sep-2020 04:03:22');

insert into employee2 values('EMP002', 'Om Sharma',8765432109,'17-aug-2020 08:30:09', ' 17-aug-


2020 09:10:22');

insert into employee2 values('EMP003', 'Rajaryan K' ,7654321098,'06-jul-2020 07:21:09', ' 06-jul-
2020 08:53:22');

insert into employee2 values('EMP004', 'Khris Lobo',7890654321,'13-sep-2020 08:21:09', ' 13-sep-


2020 09:03:22');
insert into employee2 values('EMP005', 'Sharva Dessai',8905671234,'21-oct-2020 11:45:09', ' 21-oct-
2020 12:00:00');

insert into food1 values('F001', '0001');

insert into food1 values('F002', '0002');

insert into food1 values('F003', '0003');

insert into food1 values('F004','0004');

insert into food1 values('F005', '0005');

insert into food2 values ('F001', 'Eggs Fried or Omelette',' ', 'Non Veg', 'Null', 'Available');

insert into food2 values('F002', 'Chocolate Donuts', 'Veg',' ', 'Null', 'Available');

insert into food2 values('F003', 'Aloo Fry Roll-Mashed Potatoes Sauted In Secret Spices Rolled To
Perfection In Your Favorite Base Wrap', 'Veg',' ', 'Lemon Soda', 'Not Available');

insert into food2 values('F004', 'Dark Fantasy Thickshake- Tall Dark & Handsome - What do you get
when choco fill cookies, ice cream, chocolate and a topping of fudge all come together in a dessert?
A tall, dark and handsome fantasy.', 'Veg',' ', 'Null', 'Available');
insert into food2 values('F005', 'Chicken Combo Pack - 2 Chicken Samosas +2 Chicken Croquettes + 2
Prawn and Cheese ressois+ 2 Veg and Cheese Mini Spring Rolls.',' ', 'Non Veg', 'Coke 200ml',
'Available');

insert into feedback1 values('F00001',0001 ,'C1001');

insert into feedback1 values('F00002',0002 ,'C1002');

insert into feedback1 values('F00003',0003 ,'C1003');

insert into feedback1 values('F00004',0004 ,'C1004');

insert into feedback1 values('F00005',0005 ,'C1005');

insert into feedback2 values('F00001','good service');

insert into feedback2 values('F00002','good taste');

insert into feedback2 values('F00003','on time delivery');

insert into feedback2 values('F00004','nil');


insert into feedback2 values('F00005','on time delivery');

insert into payment1 values('C1001',142478457478);

insert into payment1 values('C1002',774544758457);

insert into payment1 values('C1003',457865895255);

insert into payment1 values('C1004',214535252254);

insert into payment1 values('C1005',114274789991);

insert into payment2 values('P00001',0001);

insert into payment2 values('P00002',0002);

insert into payment2 values('P00003',0003);

insert into payment2 values('P00004',0004);

insert into payment2 values('P00005',0005);

insert into payment3 values(142478457478 ,'Sriram Srivastava',123,'03/2022',145236 );

insert into payment3 values(774544758457 ,'Lokesh W ',234,'06/2025',745812 );

insert into payment3 values(457865895255 ,'Palak A',345 ,'09/2021',145214 );


insert into payment3 values(214535252254 ,'Supreeth D',456,'11/2025',145698 );

insert into payment3 values(114274789991 ,'Bhavya garg',567 ,'01/2021',987542 );

insert into payment4 values('P00001','C1001','13-jan-2020 07:30:00',660,'10','cash',594);

insert into payment4 values('P00002','C1002','15-mar-2020 11:30:00',284 ,'4','card',272.64 );

insert into payment4 values('P00003','C1003','18-sep-2019 04:49:00',990.10 ,'nil','cash',990.10 );

insert into payment4 values('P00004','C1004','19-jul-2020 08:11:00',544.20 ,'nil','cash',544.20 );

insert into payment4 values('P00005','C1005','07-jun-2019 09:32:00', 630.20 ,'10','card',567.18 );


4. Queries with Set operators and SQL Functions:

a) Display name of employees with length of name > 10.

SELECT f_name, l_name FROM Customer

WHERE (LENGTH(f_name) + LENGTH(l_name)) > 10;

b) Calculate total sales made by the company through cash.

SELECT SUM(total_amt) FROM payment4;

C) Employees who didn’t go for delivery till now


SELECT employee2.emp_id FROM employee2
MINUS
SELECT employee1.emp_id FROM employee1;
D)
EMPLOYEES WHO WENT OUT FOR DELIVERY TILL NOW

SELECT employee2.emp_id FROM employee2


INTERSECT
SELECT employee1.emp_id FROM employee1;
5.JOIN QUERIES-INNER AND OUTER:

1.find employee name delivering order_id =4 order table and emp2

select employee2.Emp_name from employee2 inner join employee1 on


employee1.Emp_id=employee2.Emp_id and employee1.Order_id=4;

2. find phone numbers of customer named 'Palak'

select phone_number.Phone_number from Customer cross join phone_number where


Customer.cust_id=phone_number.cust_id and F_name='Palak';

3.display payment time for card no 774544758457

select payment4.payment_time from payment4 cross join payment1 where


payment1.cust_id=payment4.cust_id and card_no=774544758457;
4.

select Customer.cust_id, Customer.F_name, payment4.payment_id, payment4.total_amt from


Customer inner join payment4 on payment4.cust_id=Customer.cust_id and
Customer.F_name='Sriram';

5.

select
Customer.cust_id,Customer.F_name,Customer.L_name,Order1.Order_id,Order1.food_item_id,foo
d2.description from((Customer inner join Order1 on Customer.cust_id=Order1.cust_id)INNER join
food2 on food2.food_item_id=Order1.food_item_id);
6. display card no of all card type payments

select payment1.Card_no from payment1 inner join payment4 on


payment1.cust_id=payment4.cust_id and pay_type='card';

7. find departure time and arrival time of employees with order_id 1 .

select employee2.departure_time,employee2.arrival_time from((employee2 inner join employee1


on employee1.Emp_id=employee2.Emp_id) inner join Order1 on
employee1.order_id=Order1.order_id and Order1.order_id='1');

8. list of orders with total_amt<550


select *from payment2,payment4 where payment2.payment_id=payment4.payment_id and
total_amt<550;
9. Card details of all the Customers
select *from payment1, payment3 where payment1.Card_no=payment3.Card_no;

6.GROUP BY AND HAVING CLAUSE:


1.No.of orders by customers grouped by postal_codes
select count(cust_id),postal_code from customer
group by postal_code;

2. No.of orders company got datewise


select count(order_id),date_or

from order1

group by date_or;
REVIEW-3
1.NESTED QUERIES:
1.

select * from customer where

street>(select avg(street) from customer);

2.

select * from payment3 where

card_holder_name in (select card_holder_name from payment3 where exp_date>('01/2021'));


3.

CREATE TABLE premium_Customer(Cust_id varchar2(25) primary key,Email varchar2(40) not


null,F_name varchar2(10) not null,M_name varchar2(10),L_name varchar2(10),Password
varchar2(20),Postal_code number(6) not null,Street varchar2(15) not null,House_number
varchar2(10) not null)

INSERT INTO premium_customer

SELECT * FROM customer

WHERE cust_id in (SELECT cust_id FROM payment4 WHERE total_amt> 500);

select * from premium_customer;

4.

UPDATE CUSTOMER SET house_number = house_number + '3'

WHERE street IN (SELECT street FROM CUSTOMER WHERE street >= 4 );

select * from customer;


5.

select * from customer

where cust_id in (SELECT cust_id FROM order1 WHERE date_or = '07-jan-20');

6.

SELECT a.cust_id, a.f_name, b.total_amt

FROM customer a, payment4 b

WHERE a.cust_id = b.cust_id;

4.CURSORS USING PLSQL:


PL/SQL
Cursor: Read food item ID , description , beverage and status using CURSOR.

Set serveroutput on
DECLARE
f_id food2.food_item_id%type;
f_description food2.description%type;
f_bvg food2.beverages%type;
f_status food2.status%type;
CURSOR f_food2 is
SELECT food_item_id, description, beverages, status FROM food2;
BEGIN
OPEN f_food2;
LOOP
FETCH f_food2 into f_id, f_description, f_bvg, f_status;
EXIT WHEN f_food2%notfound;
dbms_output.put_line(f_id|| ': ' || f_description|| '--- ' || f_bvg || '----> ' || f_status);
END LOOP;
CLOSE f_food2;
END;
/

Insertion: insert values into the Order1 table using pl/sql.

set serveroutput on;


declare
o_no Order1.Order_id%type;
c_id Order1.Cust_id%type;
f_id Order1.Food_item_id%type;
e_id Order1.Emp_id%type;
d_or Order1.Date_or%type;
begin
o_no:='&o_no';
c_id:='&c_id';
f_id:='&f_id';
e_id:='&e_id';
d_or:='&d_or';
insert into Order1 values(o_no,c_id,f_id,e_id,d_or);
commit;
end;
/

Count the number of customers that gave a particular feedback message.

Set serveroutput on
declare
total number(10);
fb_msg feedback2.feedback_msg%type:='&fb_msg';
begin
select count(*) into total from feedback2 inner join feedback1 on
feedback1.feedback_id=feedback2.feedback_id and feedback2.feedback_msg=fb_msg;
dbms_output.put_line('Total number of customers that gave the feedback of '||fb_msg||' are
'||total);
end;
/
3.FUNCTION OR PROCEDURE USING PLSQL:
Procedure: to update or replace the pay_type in a payment4 for pay_id:P0003 and total
aamout:990;
set serveroutput on;

create or replace procedure ptype(p_id varchar, t_amt number) is

a payment4.pay_type%type;

begin

update payment4 set pay_type='card' where payment_id=p_id and total_amt=t_amt;

select pay_type into a from payment4 where payment_id=p_id and total_amt=t_amt;

DBMS_OUTPUT.PUT_LINE('New Payment_Type for Payment_id '||p_id||' is '||a);

end;

exec ptype('&p_id',&t_amt);

5.TRIGGERS USING PLSQL

Trigger: use a trigger to generate the age of the customers(for this first we need to alter the
customer table to add dob and then age column the we create the trigger and update the dob
values into the table)
alter table Customer add dob date;

alter table Customer add age int;

create or replace trigger fill_age

before update on Customer for each row

begin

:new.age := months_between(sysdate,:new.dob)/12;
end;

UPDATE Customer SET dob='17-jan-1997' where Cust_id='C1001';

UPDATE Customer SET dob='20-jan-1988' where Cust_id='C1002';

UPDATE Customer SET dob='12-jun-2001' where Cust_id='C1003';

UPDATE Customer SET dob='01-dec-1999' where Cust_id='C1004';

UPDATE Customer SET dob='07-apr-1991' where Cust_id='C1005';

select *from Customer;

Cursor: use pl/sql and write a cursor to give 100 rupees off to customers who are 20 or below in
age.

declare

cursor custm is select * from Customer;

c custm%rowtype;

age number;

offer int;

begin

open custm;

loop
fetch custm into c;

exit when custm%notfound;

age:=months_between(sysdate,c.dob)/12;

if(age<=20) then

update payment4 set Total_amt=Total_amt-100 where Cust_id=c.Cust_id;

end if;

end loop;

close custm;

end;

Select Total_amt from payment4;

Cursor: write a cursor to update the status of a food item with food_item_id=”F004” to ‘not
available’.

DECLARE

cursor fd is select * from food2;

f fd%rowtype;

BEGIN

open fd;

loop

fetch fd into f;

exit when fd%notfound;

if(f.status='Available') AND (f.Food_item_id='F004') then


update food2 set status='Not Available' where Food_item_id=f.Food_item_id;

end if;

end loop;

close fd;

END;

select Food_item_id, status from food2;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy