You are on page 1of 31

Module Code & Module Title

CC4057NI Introduction to Information Systems

Assessment Weightage & Type


30% Individual Coursework

Year and Semester


2019-20 Spring

Student Name: Bishal Bharati


Group: L1N10
London Met ID: 19033779
College ID: NP01NT4S200003
Assignment Due Date: 15/06/2020
Assignment Submission Date: 15/06/2020
I confirm that I understand my coursework needs to be submitted online via Google Classroom under the
relevant module page before the deadline in order for my assignment to be accepted and marked. I am
fully aware that late submissions will be treated as non-submission and a marks of zero will be awarded.
Table of Contents
1. Introduction ............................................................................................................... 1
1.1. Project Description ............................................................................................. 1
1.2. The scenario of the project ................................................................................. 1
1.3. Database ............................................................................................................ 2
1.4. Relational database ........................................................................................... 2
1.5. Tools used.......................................................................................................... 3
2. Database Model........................................................................................................ 4
2.1. ER-Diagram (Entity Relation Diagram)............................................................... 6
2.2. Relational Diagram ............................................................................................. 7
2.3. Analysis of ER- diagram and Relational diagram ............................................... 8
2.4. Screenshot ......................................................................................................... 9
3. Data Dictionary ....................................................................................................... 14
4. Queries ................................................................................................................... 21
4.1. MAX ................................................................................................................. 21
4.2. LIKE ................................................................................................................. 21
4.3. Between ........................................................................................................... 22
4.4. LIMIT ................................................................................................................ 22
4.5. WHERE ............................................................................................................ 23
4.6. AS .................................................................................................................... 23
4.7. SET .................................................................................................................. 24
4.8. DISTINCT......................................................................................................... 24
4.9. AVG ................................................................................................................. 25
4.10. JOIN.............................................................................................................. 25
4.11. Dump File Creation ....................................................................................... 26
5. Conclusion .............................................................................................................. 26
6. Bibliography ............................................................................................................ 26
List of Figures

Figure 1 - ER Diagram .................................................................................................... 7


Figure 2 - Relational Diagram ......................................................................................... 8
Figure 3 - Database Creation Syntax .............................................................................. 9
Figure 4 - Database Selection Syntax ............................................................................. 9
Figure 5 - Table Employee Creation Syntax.................................................................... 9
Figure 6 - Table Customer Creation Syntax .................................................................... 9
Figure 7 - Table Cabin Creation Syntax ........................................................................ 10
Figure 8 -Table Order Food Creation Syntax ................................................................ 10
Figure 9 - Table Bill Creation Syntax ............................................................................. 10
Figure 10 - Inserting data in Employee table ................................................................. 10
Figure 11 - Inserting data in Customer table ................................................................. 10
Figure 12 - Inserting data in Cabin table ....................................................................... 11
Figure 13 - Inserting data in Order Food table .............................................................. 11
Figure 14 - Inserting data in Bill table ............................................................................ 11
Figure 15 - Select and describe for Employee .............................................................. 12
Figure 16 - Select and describe for Customer ............................................................... 12
Figure 17 - Select and describe for Cabin ..................................................................... 13
Figure 18 - Select and describe for Order Food ............................................................ 13
Figure 19 - select and describe for Bill .......................................................................... 14

List of Tables
Table 1 - Customer attributes and data entry .................................................................. 4
Table 2 - Employee attributes and data entry.................................................................. 5
Table 3 - Order Food attributes and data entry ............................................................... 5
Table 4 - Bill attributes and data entry ............................................................................. 5
Table 5 - Table attributes and data entry......................................................................... 6
Table 6 - Data dictionary of Employee .......................................................................... 16
Table 7 - Data dictionary of Customer ........................................................................... 17
Table 8 - Data dictionary of Cabin ................................................................................. 18
Table 9 - Data dictionary of Order Food ........................................................................ 19
Table 10 - Data dictionary of Bill ................................................................................... 20
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

1. Introduction
As we are aware, a database is an electronic data set used by a corporation to store, maintain and retrieve
information. (Techopedia, 2016 ). Therefore, in our second course of research in the module information
system, we are attempting to incorporate database function methods. The database's key principle is the
use of entities and attributes in a scheme to demonstrate the relationship between the various database
data. A description of the definition and working structure of the database and the relational database is
shown below.

1.1. Project Description


This database is about a restaurant management system in Nepal. This database consists of information
and data about the customer, employees, order, table, and the payment made by the customer to buy
the food. The main need for the development of this database was to implement a safer and easier way
of managing day to day information and activity that take place in a restaurant and its related
components. As this course work demands various methods of representation and management of data
like ER diagram, relational diagram, queries etc. I have used this technological way of describing the
management of entities and attributes. Various primary keys are used to identify data uniquely in each
table, and foreign keys are used to attach, bind, and compare tables. MySQL is used to create this
database model. Every entity has their attributes like customer entity consist of the first name, last name,
customer id, phone number, address and a foreign key called cabin no.

1.2. The scenario of the project


Here we have a restaurant which consists of a total of 5 entities where each entity has a special role. Like,
in a restaurant there is a total of ‘n’ number of cabins for a customer to sit and order food. After that
employee takes order form customer to provide cuisine customer has ordered. While ordering the food
customer provides all the details about them like customer id, first name, last name, address etc. Every
customer has to make a payment and in our scenario, there is one way of doing it. It can only do by paying
cash. So to avoid contradiction a payment number is given to only those customers who have successfully
made a payment for the food to keep the count of payments done that day and uniquely identify the
customer and to know either the payment is done in the morning, day or night. And cabin entity represents
the information about cabin no and employee id who is serving in that cabin.

1
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

Lastly, all the employees are given unique employee ID the moment they start working in this organization.
In our scenario, there is a total of ‘n’ number of employees that serve in the restaurant who have their own
first and last name along with the address and phone number.

1.3. Database
The database aims to store a set of data together to support as many users as possible. As a
consequence, a database is often viewed as a collection of knowledge required to perform certain tasks in
a business or organization. Such a database will allow not only the recovery of data but also the
continuous modification of data required for the management of operations. It may be possible to scan the
database for answers to questions or information for planning purposes. (w3schools, n.d.) The database is
implemented through three general levels. These levels are:

 Internal Level or Physical level


 Conceptual Level
 External Level or View Level

All three levels are combined to create a functioning database layout. Databases have a multitude of
applications that help us establish a consistent relationship between various data components.
The key properties that allow the database of any transaction to operate properly are as follows:
1. Atomicity – guarantees a complete transaction or none at all.
2. Consistency – consistency before and after the transaction
3. Isolation – guarantees the confidentiality of the transaction
4. Durability – ensures that effective transactions are reversed even though the system breaks down.

1.4. Relational database


A relational database is a set of interconnected tables that helps us save and retrieve data. Various query
languages, such as MySQL, Oracle, are used to make DBMS work. (Sybase, 2000)
Some basic terminologies used in the relation database management system are as follows:
 Query
 Entity
 Rows / tuple

2
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

 Column / attribute
 Degree
 Cardinality
 Data integrity
 Constraints

The central principle of the relational database is that entities and attributes are constructed using specific
primary keys, foreign keys and information of various object types. Relational patterns created using rows
and columns. Columns are also known as attributes and rows are also known as a tuple. Data integrity is
the overall completeness, accuracy and consistency of data. It plays a huge role, while at the same time
involving the effects of a foreign key in a database. If we input data that is not present as a primary key in
another table as a foreign key, we only disobey the rules for data integrity.
Constraints are limitations created by users that impose additional conditions on them. Some of the basic
constraints are set out below.
 PRIMARY KEY
 FOREIGN KEY
 NOT NULL
 AUTO_INCREMENT
Primary keys are specific and special for each entry in a single table. Foreign keys are used to refer to
data from one table to another and to make a connection between them. NOT NULL is used if the entry
cannot be empty and must be filled with at least one data. AUTO INCREMENT increases a certain value
without the manual operation.

1.5. Tools used


1. MySQL
MySQL is an open-source database management system. This is based on the structure query
language (SQL) used to add, delete, and change the information in the database. (Per, March 6,
2007).
2. XAMPP
This is open-source software used to establish a local webserver. It offers a variety of Apache HTTP
servers.

3
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

2. Database Model
For the creation of a database of the restaurant management system, five different entities are used along
with specific attributes to describe the table’s characteristics.
Entities used are mentioned below:
1. Customer
2. Employee
3. Order Food
4. Bill
5. Cabin
Note: All the primary keys are denoted by red colour and all the foreign keys are denoted by yellow.
Entities along with their attributes and test data are listed below:
 Customer with the attributes Customer ID, FName, LName, Address, Mob No, Table No.

Customer ID FName LName Address Mob No Cabin No


C0111 Arun Bam Anamnagar, 9812757585 C01
KTM
C0112 Deepak Pandey Baneshwor,KTM 9868863486 C02
C0113 Chiran Shah Mahendranagar 9812383845 C03
C0114 Asmita Pandeya Kritipur 9812701033 C04
C0115 Ramesh Kunwar Dhangadi 9848773288 C05
C0116 Prakash Pal Mahendranagar 9848720886 C06
Table 1 - Customer attributes and data entry

4
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

 Employee with an attributes Employee ID, FName, LName, Address, Mob No.
Employee ID FName LName Address Mob No
E01 Zenith Giri Mahendranagar 9858750541
E02 Jasmine Bam Baneshwor, KTM 9812565648
E03 Monaj Singh Pokhara 9858750123
E04 Aman Kunwar Kotheshwor 9844723113
E05 Deepika Badal Anamnagar, 9848752886
KTM
Table 2 - Employee attributes and data entry

 Order Food with attributes Order ID, Food Name, Table No.
Order ID Food Name Cabin No
O11 Chicken MO: MO C01
O12 Black Coffee C02
O13 Veg Fried Rice C03
O14 Buff MO: MO C04
O15 Chicken Pizza C05
O16 Chicken Bugger C06
Table 3 - Order Food attributes and data entry

 Bill with attributes Bill ID, Table No, Price.


Bill ID Cabin No Price
B01111 C01 150
B01112 C02 85
B01113 C03 120
B01114 C04 100
B01115 C05 350
B01116 C06 180
Table 4 - Bill attributes and data entry

5
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

 Cabin with attributes Cabin No, Employee ID.


Cabin No Employee ID
C01 E01
C02 E02
C03 E03
C04 E04
C05 E05
C06 E06
Table 5 - Table attributes and data entry

2.1. ER-Diagram (Entity Relation Diagram)


Entity relation diagram is a visual representation of the relation between the entity and its attributes.
Below are the major types of geometric forms used in making ER-Diagram.
 Rectangles – Entity
 Circle – Attributes
 Diamond – Relation
 Underline in a circle – Primary key
 Double circle – Multivalued attribute
 Branched attribute – Composite attribute

Multivalued attributes
- Those kinds of attributes which can have more than one value are known as multivalued attributes.

Composite attributes
- Those kinds of an attribute which can be further divided into subparts are known as composite attributes.

6
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

Figure 1 - ER Diagram

2.2. Relational Diagram


The explanation for the relational diagram is similar to the ER diagram, except the presentation strategies
are special, and international keys are listed in the relation diagram, as it is not necessary for the ER
diagram.
Terminologies used in the relational diagram.
 PK – primary key
 FK – foreign key

7
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

Figure 2 - Relational Diagram

2.3. Analysis of ER- diagram and Relational diagram


For both structural representations i.e. Relational diagram and ER diagram, the clarification of the
relation between the entity and the attributes given below. The above scenario in the introductory part
plays an enormous role in the thorough analysis of this database.
Here entity Employee has five attributes where EmployeeID is a primary key and MobNo is multivalued
attributes. It has one to many relations with an entity Cabin. In both ER- diagram and relational diagram
we can clearly see that one Employee can takes order from many cabins.
In Cabin entity there are two attributes with one foreign key columns where EmployeeID links to
Employee entity. Here CabinNo ID is a primary key, MobNo is a multivalued attribute and name is a
composite attribute. In both ER and relational diagram we can clearly see that one employee can serve
many cabin.
In Customer entity there are six attributes with one foreign key columns where CabinNo links to Cabin
entity. Here CustomerID is a primary key, MobNo is a multivalued attribute and name is a composite
attribute. In both ER and relational diagram we can clearly see that many customers are served by a
single employee, one customer can order ‘n’ no foods and payment is done at once for many orders.

8
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

In OrderFood entity there are three attributes with one foreign key columns where CabinNo links to
Cabin entity. Here OrderID is a primary key. In both ER and relational diagram we can clearly see that
from one cabin there can be ‘n’ of orders can come.
In Bill entity there are three attributes with one foreign key columns where where CabinNo links to Cabin
entity. Here BillID is a primary key and price attribute gives the information about how much ordered
food is cost. In both ER and relational diagram we can clearly see that one customer can make payment
for many orders at once.

2.4. Screenshot
 Creating Table

Code for creating a database

Figure 3 - Database Creation Syntax

Code for selecting a database

Figure 4 - Database Selection Syntax

Code for creating table Employee

Figure 5 - Table Employee Creation Syntax

Code for creating table Customer

Figure 6 - Table Customer Creation Syntax

9
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

Code for creating table Cabin

Figure 7 - Table Cabin Creation Syntax

Code for creating table Order Food

Figure 8 -Table Order Food Creation Syntax

Code for creating table Bill

Figure 9 - Table Bill Creation Syntax

 Inserting data in the table


Code for insert into Employee table

Figure 10 - Inserting data in Employee table

Code for insert into Customer table

Figure 11 - Inserting data in Customer table

10
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

Code for insert into Cabin table

Figure 12 - Inserting data in Cabin table

Code for insert into Order Food table

Figure 13 - Inserting data in Order Food table

Code for insert into Bill table

Figure 14 - Inserting data in Bill table

11
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

 Select * from table and Describing table


For Table Employee

Figure 15 - Select and describe for Employee

For Table Customer

Figure 16 - Select and describe for Customer

12
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

For Table Cabin

Figure 17 - Select and describe for Cabin

For Table Order Food

Figure 18 - Select and describe for Order Food

13
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

For Table Bill

Figure 19 - select and describe for Bill

3. Data Dictionary
A Data Dictionary is a depiction of information likewise including data about the information, for example,
information types, subtleties of structure, and security limitations. (Knight, 2017)

14
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

Entity Entity Column Column Data Leng Prima Foreign Nulla Uniq Not
Name Description Name Description Type th ry Key Key ble ue es

Employee Employees EmployeeI A unique Varchar 10 True False False True


are the D identificatio
people who n number
work at the is given to
restaurant. each
employee
by a
restaurant
for
managing
a shift of
employee.
FName First Name Varchar 20 False False False False
of an
Employee
LName Last Name Varchar 20 False False False False
of an
Employee
Address The Varchar 50 False False False False
particulars
of the
place
where
Employees
lives
Mob No The Varchar 15 False False True True
contact
number of

15
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

an
Employee
Table 6 - Data dictionary of Employee

Entity Entity Column Column Data Lengt Primar Foreig Nullabl Uniqu Notes
Name Descriptio Name Description Type h y Key n Key e e
n
Custome Customer CustomerID unique Varch 15 True False False True
r s are the identificatio ar
people n value
who come assigned to
to the a customer
restaurant by a
for eating restaurant,
food. which may
be
associated
with the
invoicing or
billing for a
transaction.
FName First Name Varch 20 False False False False
of a ar
customer
LName Last Name Varch 20 False False False False
of a ar
customer
Address The Varch 50 False False False False
particulars ar

16
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

of the place
where
Customer
lives
Mob No The contact Varch 15 False False True True
number of a ar
customer
Cabin No A number Varch 15 False True True True
assigned to ar
the cabin
where
customers
are eating
their food
Table 7 - Data dictionary of Customer

17
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

Entity Entity Column Column Data Length Primary Foreign Nullable Unique Notes
Name Description Name Description Type Key Key

Cabin The cabin Cabin No A unique Varchar 15 True False False True
is the identification
medium number
size room assigned to
where a the cabin
small where
number of customers
people can can eat their
sit and eat food
food while Employee A unique Varchar 10 False True False True
they are in ID identification
a number is
restaurant. given to
each
employee
by a
restaurant
for
managing a
shift of
employee.
Table 8 - Data dictionary of Cabin

18
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

Entity Entity Column Column Data Length Primary Foreign Nullable Unique Notes
Name Description Name Description Type Key Key
Order Where OrderID A unique Varchar 10 True False False True
Food employees identification
take orders number
from the uses
customer exclusively
what they to keep
like to eat track of the
while order
sitting in Food Name of the Varchar 30 False False False True
the Name cuisine
restaurant. order by a
customer to
eat
Cabin A number Varchar 15 False True False True
No assigned to
the cabin
where
customers
are eating
their food
Table 9 - Data dictionary of Order Food

19
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

Entity Entity Column Column Data Length Primary Foreign Nullabl Unique Not
Name Description Name Description Type Key Key e es
Bill Bill is a BillID A unique Varchar 10 True False False True
small identification
paper number
where all provided
the details automatically
are given by the
about the system for
product we keeping
have track of
orderd. payment
Price It the amount INT 10 False False False True
how much
does the
food cost
that
customer
had ordered
CabinNo A number Varchar 15 False True False True
assigned to
the cabin
where
customers
are eating
their food
Table 10 - Data dictionary of Bill

20
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

4. Queries

4.1. MAX
Syntax Select MAX (Price) From Bill
Query Name MAX
Description It gives the highest value of the selected column

4.2. LIKE

Syntax select * from Customer where FName LIKE "d";

Query Name LIKE

Description Returns specified pattern from the column

21
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

4.3. Between
Syntax select * from Bill WHERE Price BETWEEN
80 and 300;

Query Name Between


Description Provide the data of selected range

4.4. LIMIT
SYNTAX select * from OrderFood ORDER BY
FoodName DESC LIMIT 2;
Query Name Limit
Description It specifies the number of records to be
returned

22
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

4.5. WHERE
Syntax select * from OrderFood WHERE FoodName
= "ChickenPizza" ;

Query Name Where


Description Returns only specific values which meet the
condition

4.6. AS
SYNTAX select Price, Price-(Price * 5) AS new_fare
from Bill;

Query Name AS

Description Renames a column with a new name

23
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

4.7. SET
Syntax update Customer set CabinNo="C06" where
CabinNo="C01";
Query Name Set
Description Specifies which value to be updated

4.8. DISTINCT
Syntax select DISTINCT(CabinNo) from Bill;

Query Name DISTINCT


Description Selects only unique values

24
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

4.9. AVG
Syntax Select AVG(Price) From Bill;
Query Name AVG
Description returns the average value of a group

4.10. JOIN
Syntax Select * from cabin join customer on
cabin.cabinno=customer.cabinno;
Query Name Join
Description It joins tables

25
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

4.11. Dump File Creation

5. Conclusion
With the assistance of this coursework, I have accomplished another degree of trust in working with the
database framework. It additionally helped me comprehend the significance of XAMPP and MYSQL while
working in the database. The way toward making the tables and shaping relations between them are even
clearer with the model of our own. It has likewise helped by giving us immense information about
information control in a database. Through this coursework, I currently have a superior comprehension of
various kinds of keys, constraints, information types and different parts of the relational database. I
currently additionally have a more clear comprehension of how ER-Diagram and Relational Diagram
perceivably outlines the database with its function.
Consequently, in short, this course work has made me qualified to at any rate work with essential
functionalities of database system utilizing open source applications like MYSQL and XAMPP.

6. Bibliography
Knight, M. (2017) DATAVERSITY [Online]. Available from: https://www.dataversity.net/what-is-a-data-dictionary/
[Accessed 25 May 2020].
Per, C. (March 6, 2007) TechTerms [Online]. Available from: https://techterms.com/definition/mysql [Accessed 22
May 2020].
Sybase. (2000) Sybase, Inc [Online]. Available from: http://www.upi.pr.it/docs/easfg/easvrfgp7.htm [Accessed 10
April 2020].
Techopedia. (2016 ) Techopedia [Online]. Available from: https://www.techopedia.com/definition/1185/database-
db [Accessed 8 April 2020].
w3schools. (n.d.) w3schools [Online]. Available from: https://www.w3schools.in/sql/database-concepts/
[Accessed 10 April 2020].

26
Bishal Bharati
CC4057NI INTRODUCTION TO INFORMATION SYSTEMS

27
Bishal Bharati

You might also like