0% found this document useful (0 votes)
16 views33 pages

Electronics Shop

About electronic store products

Uploaded by

bosschamp4693
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views33 pages

Electronics Shop

About electronic store products

Uploaded by

bosschamp4693
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

DATABASE MANAGEMENT SYSTEM

ABSTRACT

The purpose of Online Food Ordering System is to automate the existing manual system by the
help of computerized equipment’s and full-fledged compute software, fulfilling their requirements, so that
their valuable data/information can be stored for a longer period with easy accessing and manipulation of the
same. The required software and hardware are easily available and easy to work. Online Food Ordering
System, as described above, can lead to error free, secure, reliable and fast management system. It
can assist the user to concentrate on their other activities rather to concentrate on the record keeping. Thus it
will help organization in better utilization of resources. The organization can maintain computerized
records without redundant entries. That means that one need not be distracted by information that is not
relevant, while being able to reach the information. The aim is to automate its existing manual system
by the help of computerized equipment’s and full-fledged computer software, fulfilling their
requirements, so that their valuable data/information can be stored for a longer period with
easy accessing and manipulation of the same. Basically the project describes how to manage for
good performance and better services for the clients.

Dept. of CSE(ICB), BIT 1|Page


DATABASE MANAGEMENT SYSTEM

CHAPTER 1

INTRODUCTION

The purpose of this project is to automate the existing manual system by the help of
computerized equipment’s and full-fledged compute software, fulfilling their requirements, so that
their valuable data/information can be stored for a longer period with easy accessing and
manipulation of the same.

1.1 GENERAL PREVIEW:


Database is a collection of data and Management System is a set of programs to store and retrieve
those data. Based on this one can define DBMS as a collection of inter-related data and set of
programs to store & access those data in an easy and effective manner.

1.2 PROBLEM IDENTIFIED:

The "Food Delivery Management System" has been developed to override the problems
prevailing in the practicing manual system. This software is supported to eliminate and, in some
cases, reduce the hardships faced by this existing system. Moreover, this system is designed
for the particular need of the company to carry out operations in a smooth and
effective manner.

The application is reduced as much as possible to avoid errors while entering the data. It also
provides error message while entering invalid data. No formal knowledge is needed
for the user to use this system. Thus, by this all it proves it is user-friendly. Online Food
Ordering System, as described above, can lead to error free, secure, reliable and fast
management system. It can assist the user to concentrate on their other activities
rather to concentrate on the record keeping. Thus, it will help organization in better
utilization of resources.

Dept. of CSE(ICB), BIT 2|Page


DATABASE MANAGEMENT SYSTEM

1.3 OBJECTIVES:

The proposed system's objective is to overcome all the limitations and drawback of the existing system. The
online food ordering system is user-friendly web application. The main objectives of the system is its
simplicity of design and easy of implementation that shows and helps to collect most of the information about
Food Services. The system requires very low system resources and the system will work in almost all
configurations. The data can be retrieved easily. The interface is very user-friendly. The data are well
protected for personal use and the data processing is very fast. The main objectives of the proposed system
can be enumerated as follows:

• To create an online food ordering system

• To monitor the activities of the user like when the user logged in and logged out .

Functionalities provided by Online Food Ordering System are as follows:


• Provides the searching facilities based on various factors. Such as Food Item, Customer, Order,
Confirm Order.
• Online Food Ordering System also manage the Payment details online for Order details,
Confirm Order details, Food Item.
• It tracks all the information of Category, Payment, Order etc

• Manage the information of Category

• Shows the information and description of the Food Item, Customer

• To increase efficiency of managing the Food Item, Category

• It deals with monitoring the information and transactions of Order.

• Manage the information of Food Item

• Editing, adding and updating of Records is improved which results in proper resource management of
Food Item data.
• Manage the information of Order

Dept. of CSE(ICB), BIT 3|Page


DATABASE MANAGEMENT SYSTEM
CHAPTER 2

DESIGN

2.1 ENTITIES:

1.User

2.Orders

3.Items

4.Wallet

5.Order_Details

6.Wallet_Detail

1.User

Attributes of User entity are Id, Name, Username, Password, Email, Address, Contact,
Verified, Delete as shown in table 2.1.1

Attribute Data type Description


Id INTEGER Primary key
Role VARCHAR Non key attribute
Name VARCHAR Non key attribute
Username VARCHAR Non key attribute
Password VARCHAR Non key attribute
Email VARCHAR Non key attribute
Address VARCHAR Non key attribute
Contact BIGINT Non key attribute
Verified TINYINT Non key attribute
Delete TINYINT Non key attribute
Table 2.1.1: User Attributes

Dept. of CSE(ICB), BIT 4|Page


DATABASE MANAGEMENT SYSTEM
2. Orders

Attributes of Orders entity are Id, Customer_id, Address, Description, Payment_Type, Date,
Total, Status, Deleted as shown in table 2.1.2

Attribute Data type Description


Id INTEGER Primary Key
Customer_id VARCHAR Foreign Key
Address VARCHAR Non key attribute
Description VARCHAR Non key attribute
Payment_type VARCHAR Non key attribute
Date DATE Non key attribute
Total NUMBER
Status TINYINT
Deleted TINYINT
Table 2.1.2: Orders Attributes

3.Items

Attributes of Items entity are Id, Name, Price, Deleted as shown in table 2.1.3

Attributes Data type Description


Id INTEGER Primary key
Name VARCHAR Non key attribute
Price INTEGER Non key attribute
Deleted TINYINT Non key attribute
Table 2.1.3: Items Attributes

Dept. of CSE(ICB), BIT 5|Page


DATABASE MANAGEMENT SYSTEM

4.Wallet

Attributes of Wallet entity are Id, Customer_id as shown in table 2.1.4

Attributes Data type Description


Id INTEGER Primary key
Customer_id INTEGER Foreign key
Table 2.1.4: Wallet Attributes

5.Order_Details

Attributes of Order_Details entity are Id, Order_ID, Item_ID, Quantity, Price as shown in table 2.1.5

Attributes Data type Description


Id INTEGER Primary key
Order_ID INTEGER Foreign Key
Item_ID INTEGER Foreign Key
Quantity INTEGER Non key attribute
Price INTEGER Non key attribute
Table 2.1.5 Order_Details Attributes
6.Wallet_Details

Attributes of Doctor entity are ID , Wallet_ID,Number ,CVV,Balance as shown in table 2.1.6

Attributes Data type Description


ID INTEGER Primary key
Wallet_ID INTEGER Foreign Key
Number VARCHAR Non key attribute
CVV INTEGER Non key attribute
Balance INTEGER Non key attribute
Table 2.1.6: Wallet_Details Attributes

Dept. of CSE(ICB), BIT 6|Page


DATABASE MANAGEMENT SYSTEM
2.2 ER DIAGRAM:

Entity Relationship Model (ER Modelling) is a graphical approach to database design. It is a high-
level data model that defines data elements and their relationship for a specified software system.
An ER model is used to represent real-world objects.

Figure 2.2.1: ER Diagram of Food Delivery Management System

Dept. of CSE(ICB), BIT 7|Page


DATABASE MANAGEMENT SYSTEM
2.3 SCHEMA DIAGRAM:

Fig 2.3.1: Schema Diagram for Food Delivery Management System

2.4 NORMALIZATION:
Normalization is a process of organizing the data in database to avoid data redundancy, insertion anomaly,
update anomaly & deletion anomaly.

Database Normalization is a technique of organizing the data in the database. Normalization is a


systematic approach of decomposing tables to eliminate data redundancy(repetition) and undesirable
characteristics like Insertion, Update and Deletion Anomalies. It is a multi-step process that puts
data into tabular form, removing duplicated data from the relation tables.

2.4.1 First Normal form:

For a table to be in the First Normal Form, it should follow the following 4 rules:

1. It should only have single(atomic) valued attributes/columns.

2. Values stored in a column should be of the same domain


3. All the columns in a table should have unique names.

4. And the order in which data is stored, does not matter.

Dept. of CSE(ICB), BIT 8|Page


DATABASE MANAGEMENT SYSTEM
All the tables have achieved 1NF by converting multi-valued attribute into separate entities.

Normalization:

• The user has the required atomic valued attributes i.e; id, name, email, address, contact which are
unique.
• Each user is unique since he/she has a unique id.

• Hence this ensures that the system is following the 1 st Normal Form.

2.4.2 Second Normal form:

For a table to be in the Second Normal Form,

1. It should be in the First Normal form.

2. And, it should not have Partial Dependency.

All the tables which are part of this project are in 2NF as they have atmost one primary key, so no partial
dependency.

Normalization:

• The system already follows the 1st Normal Form.

• There is no partial dependency in the order_details and wallet tables.

• Hence this ensues the 2nd Normal Form

2.4.3 Third Normal form:

A table is said to be in the Third Normal Form when,

1. It is in the Second Normal form.

2. And, it doesn't have Transitive Dependency.

All the used tables satisfy both these conditions and hence are in 3NF.

Normalization:

• The system already follows 2nd Normal Form.

• It does not have any transitive relation in the database so, automatically the system follows 3 rd normal
form.

Dept. of CSE(ICB), BIT 9|Page


DATABASE MANAGEMENT SYSTEM

CHAPTER 3
METHODOLOGY

3.1 SOFTWARE AND HARDWARE REQUIREMENT:

The program works on Desktop PC and is executed using a Python flask which interacts with a
MySQL database running on localhost.

3.1.1 Software Requirements:

1. Operating System: Windows 7/8/10, LINUX


2. Back End: MySQL
3. Front End: HTML, CSS, JavaScript ,Bootstrap and Php

3.1.2 Hardware Requirements:

1.Hard disk – 15 GB or Above


2.RAM – minimum 1 GB or Above
3.Processor – Intel core i4/i5/i7

3.1.3 DB Access and connectivity:

Database is accessed using connect.php. <?php

session_start();

$servername = "localhost";

$server_user = "root";

$server_pass = "";

$dbname = "food";

$name = $_SESSION['name'];

$role = $_SESSION['role'];

$con = new mysqli($servername, $server_user, $server_pass, $dbname); ?>

Dept. of CSE(ICB), BIT 10 |


Page
DATABASE MANAGEMENT SYSTEM

CHAPTER 4

IMPLEMENTATION

4.1 BASIC STEPS IN IMPLEMENTATION:


 Every user has an account with can only be registered by a government certified hospital, which
will keep all the information as defined in Problem Statement.
 Only Hospitals are eligible to request for a donation or procurement transaction.

 Government organizations will keep a watch on the pairing of donors and Patients and can approve
a transplantation operation if all the rules are satisfied.

 Collecting Statistical Data through the history of Transplantation Transaction .

4.2 TECHNOLOGIES AND FRAMEWORKS:

HTML
Hypertext Markup Language is the standard markup language for documents designed to be
displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets and
scripting languages such as JavaScript.

CSS
Cascading Style Sheets is a style sheet language used for describing the presentation of a
document written in a markup language like HTML. CSS is a cornerstone technology of the
World Wide Web, alongside HTML and JavaScript. Functional Modules.

JavaScript

JavaScript, often abbreviated as JS, is a high-level, interpreted scripting language that conforms to the
ECMAScript specification. JavaScript has curly-bracket syntax, dynamic typing, prototype-based
object-orientation, and first-class functions.
Materialize

Materialize is a UI component library which is created with CSS, Javascript and HTML. It is created
and designed by Google. Materialize CSS is also know as Material Design. It is a design language
which combines the classic principles of successful design along with innovation and technology.

Dept. of CSE(ICB), BIT 11 |


Page
DATABASE MANAGEMENT SYSTEM

4.3 FRONTEND CODE:


This section contains the “view” part of the code. It is used to implement php sessions and defines the overall
user interface.

1. <?php

session_start();

if(isset($_SESSION['admin_sid']) || isset($_SESSION['customer_sid']))

header("location:index.php");

This checks if the individual is either an existing user or admin.

2. <?php include 'includes/connect.php';


include 'includes/wallet.php';

if($_SESSION['customer_sid']==session_id())

This checks whether current session id matches the session id of the currently logged in customer.

3. <?php

$sql = mysqli_query($con, "SELECT DISTINCT status FROM orders WHERE customer_id =

$user_id;"); while($row = mysqli_fetch_array($sql)){ echo '<li><a


href="orders.php?status='.$row['status'].'">'.$row['status'].'</a></li>';

?>

This is used select orders which have different status(Delivered, Yet to be Delivered). 4. <?php

} else

if($_SESSION['admin_sid']==session_id())

Dept. of CSE(ICB), BIT 12 |


Page
DATABASE MANAGEMENT SYSTEM
header("location:admin-page.php");

} else{

header("location:login.php");

?>

This is used to check if the login is being done by the Admin or not.

5. <?php foreach ($_POST as $key =>


$value)

if(is_numeric($key)){ echo '<input type="hidden" name="'.$key.'"


value="'.$value.'">';

?>

<input type="hidden" name="payment_type" value="<?php echo $_POST['payment_type'];?>">

<input type="hidden" name="address" value="<?php echo


htmlspecialchars($_POST['address']);?>">

<?php if (isset($_POST['description'])) { echo'<input type="hidden" name="description"


value="'.htmlspecialchars($_POST['description']).'">';}?>

<?php if($_POST['payment_type'] == 'Wallet') echo '<input type="hidden" name="balance" value="<?php


echo ($balance-$total);?>">'; ?>

<input type="hidden" name="total" value="<?php echo $total;?>">

<div class="input-field col s12">

<button class="btn cyan waves-effect waves-light right" type="submit" name="action" <?php


if($_POST['payment_type'] == 'Wallet') {if ($balance-$total < 0) {echo 'disabled'; }}?>

This subtracts the total amount of the order from the wallet balance and returns the updated balance.

6. <?php

include '../includes/connect.php';

$status = $_POST['status'];

Dept. of CSE(ICB), BIT 13 |


Page
DATABASE MANAGEMENT SYSTEM
$id = $_POST['id'];

$sql = "UPDATE orders SET status='$status' WHERE id=$id;";

$con->query($sql); header("location:
../all-orders.php"); ?>

This is used to update the order status.

4.4 TABLE CREATION:


Creating a basic table involves naming the table and defining its columns and each column's data type.

The SQL CREATE TABLE statement is used to create a new table. Syntax
The basic syntax of the CREATE TABLE statement is as follows − CREATE
TABLE

table_name( column1 datatype,


column2 datatype,

column3 datatype,

.....

columnN datatype,

PRIMARY KEY (one or more columns)

);

CREATE TABLE is the keyword telling the database system what you want to do. In this case, you
want to create a new table. The unique name or identifier for the table follows the CREATE TABLE
statement.

Then in brackets comes the list defining each column in the table and what sort of data type it is.

The SQL CREATE DATABASE statement is used to create a new SQL database.

Syntax

The basic syntax of this CREATE DATABASE statement is as follows −

CREATE DATABASE DatabaseName;

Always the database name should be unique within the RDBMS.

Dept. of CSE(ICB), BIT 14 |


Page
DATABASE MANAGEMENT SYSTEM

1.Creation of new database named DBMS_PROJECT

CREATE DATABASE food;

USE food;

2.Creation of table items CREATE


TABLE `items` (
`id` int(11) NOT NULL,

`name` varchar(20) NOT NULL,

`price` int(11) NOT NULL,

`deleted` tinyint(4) NOT NULL DEFAULT '0'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

3.Creation of table orders CREATE


TABLE `orders` (
`id` int(11) NOT NULL,

`customer_id` int(11) NOT NULL,

`address` varchar(300) NOT NULL,

`description` varchar(300) NOT NULL,

`date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,

`payment_type` varchar(16) NOT NULL DEFAULT 'Wallet',

`total` int(11) NOT NULL,

`status` varchar(25) NOT NULL DEFAULT 'Yet to be delivered',

`deleted` tinyint(4) NOT NULL DEFAULT '0'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

3.Creation of table order_details

CREATE TABLE `order_details` (

`id` int(11) NOT NULL,

Dept. of CSE(ICB), BIT 15 |


Page
DATABASE MANAGEMENT SYSTEM
`order_id` int(11) NOT NULL,

`item_id` int(11) NOT NULL,

`quantity` int(11) NOT NULL,

`price` int(11) NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

4.Creation of table users

CREATE TABLE `users` (

`id` int(11) NOT NULL,

`role` varchar(15) NOT NULL DEFAULT 'Customer',

`name` varchar(15) NOT NULL,

`username` varchar(10) NOT NULL,

`password` varchar(16) NOT NULL,

`email` varchar(35) DEFAULT NULL,

`address` varchar(300) DEFAULT NULL,

`contact` bigint(11) NOT NULL,

`verified` tinyint(1) NOT NULL

DEFAULT '0',

`deleted` tinyint(4) NOT NULL

DEFAULT '0'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

5.Creation of table wallet

CREATE TABLE `wallet` (

`id` int(11) NOT NULL,

`customer_id` int(11) NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Dept. of CSE(ICB), BIT 16 |


Page
DATABASE MANAGEMENT SYSTEM
6.Creation of table wallet_details CREATE
TABLE `wallet_details` (
`id` int(11) NOT NULL,

`wallet_id` int(11) NOT NULL,

`number` varchar(16) NOT NULL,

`cvv` int(3) NOT NULL,

`balance` int(11) NOT NULL DEFAULT '2000'

) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--------------------------------------------

ALTER TABLE `items`

ADD PRIMARY KEY (`id`),

ADD UNIQUE KEY `name` (`name`),

ADD UNIQUE KEY `id` (`id`);

--------------------------------------------

ALTER TABLE `orders`

ADD PRIMARY KEY (`id`),

ADD UNIQUE KEY `id` (`id`),

ADD KEY `customer_id` (`customer_id`);

--------------------------------------------

ALTER TABLE `order_details`

ADD PRIMARY KEY (`id`),

ADD UNIQUE KEY `id` (`id`),

ADD KEY `item_id` (`item_id`),

ADD KEY `order_id` (`order_id`); --------------------------------------------

ALTER TABLE `users`

ADD PRIMARY KEY (`id`),

Dept. of CSE(ICB), BIT 17 |


Page
DATABASE MANAGEMENT SYSTEM
ADD UNIQUE KEY `username` (`username`),

ADD UNIQUE KEY `id` (`id`);

--------------------------------------------

ALTER TABLE `wallet`

ADD PRIMARY KEY (`id`),

ADD UNIQUE KEY `customer_id` (`customer_id`),

ADD UNIQUE KEY `id` (`id`);

--------------------------------------------

ALTER TABLE `wallet_details`

ADD PRIMARY KEY (`id`),

ADD UNIQUE KEY `wallet_id` (`wallet_id`),

ADD UNIQUE KEY `id` (`id`);

--------------------------------------------

ALTER TABLE `items`

MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

--------------------------------------------

ALTER TABLE `orders`

MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--------------------------------------------

ALTER TABLE `order_details`

MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=56;

--------------------------------------------

ALTER TABLE `tickets`

MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--------------------------------------------

Dept. of CSE(ICB), BIT 18 |


Page
DATABASE MANAGEMENT SYSTEM
ALTER TABLE `ticket_details`

MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--------------------------------------------

ALTER TABLE `users`

MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--------------------------------------------

ALTER TABLE `wallet`

MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

ALTER TABLE `wallet_details`

MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--------------------------------------------

ALTER TABLE `orders`

ADD CONSTRAINT `orders_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `users`

(`id`);

--------------------------------------------

ALTER TABLE `order_details`

ADD CONSTRAINT `order_details_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `items`

(`id`),

ADD CONSTRAINT `order_details_ibfk_2` FOREIGN KEY (`order_id`) REFERENCES `orders`

(`id`);

--------------------------------------------

ALTER TABLE `tickets`

ADD CONSTRAINT `tickets_ibfk_1` FOREIGN KEY (`poster_id`) REFERENCES `users` (`id`);

--------------------------------------------

ALTER TABLE `ticket_details`

Dept. of CSE(ICB), BIT 19 |


Page
DATABASE MANAGEMENT SYSTEM
ADD CONSTRAINT `ticket_details_ibfk_1` FOREIGN KEY (`ticket_id`) REFERENCES `tickets`

(`id`),

ADD CONSTRAINT `ticket_details_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users`

(`id`);

--------------------------------------------

ALTER TABLE `wallet`

ADD CONSTRAINT `wallet_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `users`

(`id`);

--------------------------------------------

ALTER TABLE `wallet_details`

ADD CONSTRAINT `wallet_details_ibfk_1` FOREIGN KEY (`wallet_id`) REFERENCES `wallet`

(`id`);

4.5 INSERTION OF VALUES


The SQL INSERT INTO Statement is used to add new rows of data to a table in the database.

Syntax

There are two basic syntaxes of the INSERT INTO statement which are shown below.

INSERT INTO TABLE_NAME (column1, column2, column3,...columnN)

VALUES (value1, value2, value3,...valueN);

Here, column1, column2, column3,...columnN are the names of the columns in the table into which you
want to insert the data.

You may not need to specify the column(s) name in the SQL query if you are adding values for all
the columns of the table. But make sure the order of the values is in the same order as the columns
in the table.

The SQL INSERT INTO syntax will be as follows −

INSERT INTO TABLE_NAME VALUES (value1,value2,value3,...valueN);

Dept. of CSE(ICB), BIT 20 |


Page
DATABASE MANAGEMENT SYSTEM
Insertion of values in different tables used in the project

INSERT INTO `items` (`id`, `name`, `price`, `deleted`) VALUES (1,


'Grilled Sandwich', 5, 0);

INSERT INTO `orders` (`id`, `customer_id`, `address`,

`description`, `date`, `payment_type`, `total`, `status`,

`deleted`) VALUES (7, 2, '2698 Meadowcrest Lane', '', '2021-05-03


22:02:53', 'Cash On Delivery', 85, 'Yet to be delivered', 0);

INSERT INTO `order_details` (`id`, `order_id`, `item_id`,

`quantity`, `price`) VALUES (15, 7, 2, 1, 45);

INSERT INTO `users` (`id`, `role`, `name`, `username`,

`password`, `email`, `address`, `contact`, `verified`, `deleted`)

VALUES (1, 'Administrator', 'Admin', 'admin', 'admin123',

'[email protected]', '1485 Blecker Street', 3450001440, 1, 0);

INSERT INTO `wallet` (`id`, `customer_id`) VALUES

(1, 1);

INSERT INTO `wallet_details` (`id`, `wallet_id`, `number`,

`cvv`, `balance`) VALUES (1, 1, '6155247490533921', 983, 3430);

Dept. of CSE(ICB), BIT 21 |


Page
DATABASE MANAGEMENT SYSTEM

CHAPTER 5

TESTING
5.1 TRIGGERS:

A trigger is a stored procedure in database which automatically invokes whenever a special event in
the database occurs. For example, a trigger can be invoked when a row is inserted into a specified
table or when certain table columns are being updated.

1.Trigger to create a Wallet when a user is registered

CREATE TRIGGER `add_wallet` AFTER INSERT ON `users`

FOR EACH ROW INSERT INTO wallet VALUES

(new.id, new.id);

2.Trigger to add balance in wallet

CREATE TRIGGER `set_wallet_details` AFTER INSERT ON `wallet`

FOR EACH ROW INSERT INTO wallet_details

(wallet_id, number, cvv, balance)

VALUES (new.customer_id, CAST(FLOOR(RAND()*10e15) as varchar(16)), FLOOR((RAND()*10e2)),


1000);

5.2 QUERIES:

A query is a question, often expressed in a formal way. A database query cab be an normal or an action query.
CRUD operations are performed in the backend.

The following are set of queries used in project:


1. "INSERT INTO users (username, password, name, email, contact, address, role, verified, deleted)
VALUES ('$username', '$password', '$name', '$email', $contact, '$address', '$role', $verified,
$deleted)"

This query is used to insert user into the table when a new user registers.

2. "UPDATE users SET name = '$name', username = '$username', password='$password',


contact=$phone, email='$email', address='$address' WHERE id = $user_id;"

Dept. of CSE(ICB), BIT 22 |


Page
DATABASE MANAGEMENT SYSTEM
This query updates the user’s information in the user table.

3. "UPDATE orders SET status='$status' WHERE id=$id;" This query updates the order status.

4. "UPDATE wallet_details SET balance = $balance WHERE wallet_id = $wallet_id;"

It updates the wallet details for the given ‘wallet_id’.

5. "SELECT * FROM users WHERE username='$username' AND password='$password' AND


role='Administrator' AND not deleted;"

This query is used to recognize Administrator.

6. "INSERT INTO wallet_details(wallet_id, number, cvv) VALUES ($wallet_id, $cc_number,


$cvv_number)";

This is used to insert wallet details of a customer.

5.3 SOFTWARE TESTING:

5.3.1 Introduction to Testing

Software Testing is a method to check whether the actual software product matches expected
requirements and to ensure that software product is Defect free. It involves execution of
software/system components using manual or automated tools to evaluate one or more properties of
interest. The purpose of software testing is to identify errors, gaps or missing requirements in contrast
to actual requirements.

5.3.2 Testing Objectives:

• Testing is process of executing a program with the intent of finding an error.

• A good test case design is one that has a probability of finding an as yet undiscovered error.

• A successful test is one that uncovers an as yet undiscovered error.

• These above objectives imply a dramatic change in view port.

• Testing cannot show the absence of defects, it can only show that software errors are present.

Dept. of CSE(ICB), BIT 23 |


Page
DATABASE MANAGEMENT SYSTEM
5.3.3 Testing Principles:

• All tests should be traceable to end user requirements.

• Tests should be planned long before testing begins.

• Testing should begin on a small scale and progress towards testing in large.

• Exhaustive testing is not possible.

5.3.4 Validation Testing

The process of evaluating software during the development process or at the end of the development
process to determine whether it satisfies specified business requirements. Validation Testing ensures
that the product actually meets the client's needs. It can also be defined as to demonstrate that the
product fulfills its intended use when deployed on appropriate environment.

5.3.5 Unit Testing:

In this test the entire system is divided into smaller entities and each entity is known as a unit and
each unit is tests one at a time. The test ensures the working of each module as per the requirement
in functionality point of view rather actual module visible to the user.

5.3.6 Integration Testing:

In this test each unit is looped together to form a long and continuous chain of modules till it does
not cover the entire system. The test checks the behavior of the interface. This test is generally
performed after unit test.

Dept. of CSE(ICB), BIT 24 |


Page
DATABASE MANAGEMENT SYSTEM
5.4 TEST CASES:

Test Test name Actual output Expected output Status


No.
1 login Successfully logged Successfully logged in pass
in
2 Searching for user User details must be User details must Be pass
shown shown
3 Adding new data New data created New data created pass

4 Deleting the data Data deleted Data deleted pass

5 Updating the data Data updated Data updated pass

Table 5.4.1: Test cases

Figure 5.4.1: Login page

Dept. of CSE(ICB), BIT 25 |


Page
DATABASE MANAGEMENT SYSTEM

Figure 5.4.2: Index Page

Figure 5.4.3: Place Order page

Dept. of CSE(ICB), BIT 26 |


Page
DATABASE MANAGEMENT SYSTEM

5.4.3: Place Order page

Figure 5.4.4: Details Page

Dept. of CSE(ICB), BIT 27 |


Page
DATABASE MANAGEMENT SYSTEM

Figure 5.4.5: All- Order page

Figure 5.4.6 Orders page

Dept. of CSE(ICB), BIT 28 |


Page
DATABASE MANAGEMENT SYSTEM

Figure 5.4.7 Admin page

Figure 5.4.8 Users page

Dept. of CSE(ICB), BIT 29 |


Page
DATABASE MANAGEMENT SYSTEM

Figure 5.4.9 All Order page

Dept. of CSE(ICB), BIT 30 |


Page
DATABASE MANAGEMENT SYSTEM

Figure 5.4.10: Register Page

Dept. of CSE(ICB), BIT 31 |


Page
DATABASE MANAGEMENT SYSTEM

CHAPTER 7

CONCLUSION
The application is based on user’s requirement and is user centred. All issues related to all user which are
included in this system are developed by this system. If people know how to operate android smart phone
wide variety of people can use the application. This system will solve the various issues related to Mess/Tiffin
service. To help and solve important problems of people implementation of Online Food Ordering system is
done.

It can be concluded that, based on the application: Orders are made easily by this system; Information needed
in making order to customer is provided by the system. Receiving orders and modifying its data is possible
through the application and it also helps admin in controlling all the Food system.

Dept. of CSE(ICB), BIT 32 |


Page
DATABASE MANAGEMENT SYSTEM

REFERENCES

• Database System Models, Languages, Ramez Elmasri and Sham Kant B. Navathe, 7th Edition, 2017
Pearson.

• Fundamentals of Web Development, Randy Connolly and Ricardo Hoar ,First Impression, 2016
Pearson.
• www.stackoverflow.com

• www.guru99.com

• www.w3schools.com

• www.geeksforgeeks.com

• www.github.com

Dept. of CSE(ICB), BIT 33 |


Page

You might also like