You are on page 1of 52

Module Code & Module Title

CC6001NI – Advanced Database Systems Development

Assessment Weightage & Type


40% Individual Coursework

Year and Semester


2020-21 Autumn

Student Name: Sonika Timsina


London Met ID: 18030062
College ID: NP01CP4A180214
Assignment Due Date: March 19, 2021
Assignment Submission Date: March 19, 2021

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.
CC6001NI Advanced Database Systems Development
CC6001NI Advanced Database Systems Development

Table of Contents
1. Introduction .......................................................................................................... 1
2. Initial ER Diagram ................................................................................................ 2
3. Normalization ....................................................................................................... 3
3.1. Figure 1 ......................................................................................................... 3
3.2. Figure 2 ......................................................................................................... 6
3.3. Integration and Assumption ........................................................................ 10
3.4. Final Tables................................................................................................. 12
4. Data Dictionary .................................................................................................. 13
5. Generation of Database ..................................................................................... 20
5.1. DDL Scripts ................................................................................................. 20
5.2. DML Scripts................................................................................................. 33
5.3. Entity Relationship Diagram ........................................................................ 38
6. References ........................................................................................................ 48
CC6001NI Advanced Database Systems Development

Table of Figures
Figure 1: Initial ER Diagram ....................................................................................... 2
Figure 2: Final ER Diagram .........................................Error! Bookmark not defined.

Table of Tables
Table 1: Normalization Table 1 .................................................................................. 3
Table 2: Customer Data-Dictionary .............................Error! Bookmark not defined.
Table 3: Restaurant Data-Dictionary ........................................................................ 14
Table 4: Dish Data-Dictionary .................................................................................. 14
Table 5: Order Data-Dictionary ................................................................................ 15
Table 6: DeliveryAddress Data-Dictionary................................................................ 16
Table 7: LoyaltyPoint Data-Dictionary ...................................................................... 17
Table 8: RestaurantDish Data-Dictionary ................................................................. 18
Table 10: OrderTotal Data-Dictionary....................................................................... 19
CC6001NI Advanced Database Systems Development

1. Introduction
A database means a well-ordered collection of structured data which is
generally stored electronically in a computer system. A database is mostly controlled
by a database management system (DBMS). Together, the information and the
DBMS, along with the applications that are associated with them, are referred to as a
database system, often shortened to just database. Data within the most common
types of databases in operation today is typically modeled in rows and columns in a
series of tables to make processing and data querying efficient. The data can then be
easily accessed, managed, modified, updated, controlled, and organized. Most
databases use structured query language (SQL) for writing and querying data. (oracle,
2021)

The given coursework is to design and develop a database system for


GoodFood company which is available in web and mobile platforms to provide online
food ordering and delivery system.

There are different types of tools used while doing this coursework and they
are;

• Visual Studio
• Oracle Database
• SQL
• SQL developer
• Oracle SQL developer Data Modeler

Sonika Timsina 1
CC6001NI Advanced Database Systems Development

2. Initial ER Diagram
Below is the initial er diagram from studying the scenario:

Figure 1: Initial ER Diagram

The initial ER diagram given above is made looking at the scenarios provided in
the question. The relation between entities and their attributes is shown in this initial
ER diagram for GoodFood application. In this application, customer will make orders
of the dishes from the listed/preferred restaurant in the GoodFood application.

Sonika Timsina 2
CC6001NI Advanced Database Systems Development

3. Normalization
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. (javatpoint, n.d.)

3.1. Figure 1

Table 1: Normalization Table 1

➢ UNF (Un-normalized Form)

UNF gives us all attributes of entity Dish from the above figure 1 along with the
repeating groups and repeating data.

• Dish (DishCode(CK), DishName, LocalName, {RestaurantID,


RestaurantName, RestaurantAddress, RestaurantContact})

➢ 1NF (First Normal Form)

1NF is extracted after eliminating repeating group in individual tables, then creating
a separate table for such groups by giving a primary key for each separate table.

Dish-1 (DishCode(PK), DishName, LocalName)


DishRestaurant-1 (DishCode(FK), RestaurantID(FK), RestaurantName,
RestaurantAddress, RestaurantContact)

Sonika Timsina 3
CC6001NI Advanced Database Systems Development

❖ 2NF (Second Normal Form)


In 2NF, any partial dependency is identified and eliminated from each table. This
means any foreign or composite keys that determine the values of other attributes are
identified and eliminated.

In Dish table,
• Dish-1 (DishCode(PK), DishName, LocalName)

There is no partial dependency because Dish table has no foreign or composite keys.

In Dish-Restaurant table,
• DishRestaurant1 (DishCode(FK), RestaurantID(FK), RestaurantName,
RestaurantAddress, RestaurantContact)
Checking for partial dependencies:
DishCode, RestaurantID →
RestaurantID → RestaurantName, RestaurantAddress, RestaurantContact
Then, tables are,

- DishRestaurant2 (DishCode(FK), RestaurantID(FK))


- Restaurant2 (RestaurantID(PK), RestaurantName, RestaurantAddress,
RestaurantContact)

Final tables after 2NF,

Dish-2 (DishCode(PK), Dish Name, Another Name)


DishRestaurant-2 (DishCode(FK), RestaurantID(FK))
Restaurant-2 (RestaurantID(PK), RestaurantName, RestaurantAddress,
RestaurantContact)

Sonika Timsina 4
CC6001NI Advanced Database Systems Development

➢ 3NF (Third Normal Form)


In 3NF, transitive dependency is identified and eliminated which means the fields that
depend on the non-key.

Dish (DishCode(PK), DishName, LocalName)


Dish-Restaurant (DishCode(FK), RestaurantID(FK))
Restaurant (RestaurantID(PK), RestaurantName, RestaurantAddress,
RestaurantContact)

Sonika Timsina 5
CC6001NI Advanced Database Systems Development

3.2. Figure 2

➢ UNF (Un-Normalized Form)


• OrderRegister (SN(CK), DateTime, OrderNumber, OrderAmount, DeliveryPoint,
Status, {Restaurant, {DishCode, DishName, OrderUnit, DishRate, LineTotal}})

➢ 1NF (First Normal Form)


OrderRegister1 (SN(PK), DateTime, OrderNumber, OrderAmount, DeliveryPoint,
Status)
OrderRestaurant1 (SN(FK), RestaurantID(FK), RestaurantName,
RestaurantAddress, RestaurantContact)
OrderTotal1 (SN(FK), RestaurantID(FK), DishCode(FK), DishName, OrderUnit,
DishRate, LineTotal)

➢ 2NF (Second Normal Form)

1. OrderRegister-1 (SN(PK), DateTime, OrderNumber, OrderAmount, DeliveryPoint,


Status)

Since, this table doesn’t have any composite key there is no any partial dependency.

2. OrderRestaurant-1 (SN(FK), RestaurantID(FK), RestaurantName,


RestaurantAddress, RestaurantContact)

Checking for partial dependencies,

SN →

Sonika Timsina 6
CC6001NI Advanced Database Systems Development

SN, RestaurantID →

RestaurantID → RestaurantName, RestaurantAddress, RestaurantContact

Then, tables are

OrderRestaurant-2 (SN(FK), RestaurantID(FK))

Restaurant2 (RestaurantID(PK), RestaurantName, RestaurantAddress,


RestaurantContact)

3. OrderTotal-2 (SN(FK), RestaurantID(FK), DishCode(FK), DishName, OrderUnit,


DishRate, LineTotal)

Checking for partial dependencies,

SN →

SN, RestaurantID →

SN, DishCode →

SN, RestaurantID, DishCode → OrderUnit, LineTotal

RestaurantID, DishCode → DishRate

DishCode → DishName

Then, tables are,

OrderTotal-2 (SN(FK), RestaurantID(FK), DishCode( FK), Order Unit, Line


Total)

RestaurantDish-2 (RestaurantID(FK), DishCode(FK), Dish Rate)

Dish-2 (DishCode(PK), Dish Name)

Sonika Timsina 7
CC6001NI Advanced Database Systems Development

Final tables after 2NF,

OrderRegister-2 (SN(PK), OrderNumber, DateTime, OrderNumber, OrderAmount,


DeliveryPoint, Status)
Restaurant-2 (RestaurantID(PK), RestaurantName, RestaurantAddress,
RestaurantContact)
OrderTotal-2 (SN(FK), RestaurantID(FK), DishCode(FK), Order Unit, Line Total)
Dish-2 (DishCode(PK), Dish Name)
RestaurantDish-2 (RestaurantID(FK), DishCode(FK), Dish Rate)

Sonika Timsina 8
CC6001NI Advanced Database Systems Development

➢ 3NF (Third Normal Form)


In 2NF, there is no transitive dependency in any entity, thus, the 2NF can be directly
converted to 3NF without making any changes.

Final Tables from figure 2:

OrderRegister (SN(PK), OrderNumber, DateTime, OrderNumber, OrderAmount,


DeliveryPoint, Status)

Restaurant (RestaurantID(PK), RestaurantName, RestaurantAddress,


RestaurantContact)

OrderTotal (SN(FK), RestaurantID(FK), DishCode(FK), Order Unit, Line Total)

Dish (DishCode(PK), Dish Name)

RestaurantDish (RestaurantID(FK), DishCode(FK), Dish Rate)

Integrating between tables from Figure 1 and Figure 2, then the final tables are,

Dish (DishCode(PK), DishName, LocalName)


Restaurant (RestaurantID(PK), RestaurantName, RestaurantAddress,
RestaurantContact)

OrderRegister (SN(PK), DateTime, OrderNumber, OrderAmount, DeliveryPoint,


Status)

RestaurantDish (RestaurantID(FK), DishCode(FK), DishRate)

(Dish Rate field was not in Dish-Restaurant table from figure 1, thus, from figure 2 we
get DishRate field and it is integrated in RestaurantDish table as DishRate is
determined by the combination of DishCode and Restaurant but not separately.)

OrderTotal (SN(FK), RestaurantID(FK), DishCode(FK), OrderUnit, LineTotal)

Sonika Timsina 9
CC6001NI Advanced Database Systems Development

3.3. Integration and Assumption


a) Dish Availability

For checking the availability of the dish by customer in any restaurant,


DishAvailabity is added in RestaurantDish table.

• RestaurantDish (RestaurantID(FK), DishCode(FK), DishRate, DishAvailability)

b) Customer

The system is required to take and track all the customer details so that they could
deliver the orders, so Customer is a main entity in GoodFood system.

• Customer (CustomerID(PK), CustomerName, CustomerLocation,


CustomerContact, CustomerEmail)

As a foreign key, customer reference id is added because it will be necessary to


know the customers order. So, customer details is present in OrderRegister.

• OrderRegister (SN(PK) , CustomerID(FK), Order Number, Date/Time, Order


Amount, Delivery Point, Status)

c) Delivery Address

To know or track customer’s address where the dish is needed to be delivered,


a separate table is created.

• DeliveryAddress (DeliveryAddressID(PK), AddressName, Latitude, Longitude)

The system should know the delivery address given by the customer while making
the order. So, in the OrderRegister table, delivery address reference id is added.

• OrderRegister (SN(PK), CustomerID(FK), DeliveryAddressID(FK),


OrderNumber, Date/Time, OrderAmount, Status)

Sonika Timsina 10
CC6001NI Advanced Database Systems Development

d) Loyalty Points

There is a loyalty point for the dishes which are given for a certain day and duration.
So, for this a table is created.

• LoyaltyPoint (LPID(PK), Points, StartTime, EndTime)

To relate the Dish and Loyalty point, there should be a bridge entity.

• DishLoyalty(DishCode(FK), LoyaltyPointID(FK))

When the customer orders the dishes, they are given loyalty points which will be
very useul for them as they can get certain amount of discount in another orders. So,
in OrderTotal table, TotalPoints is added.

• OrderTotal(SN(FK), RestaurantID(FK), DishCode(FK), OrderUnit, LineTotal,


TotalPoints)

The total points obtained from order the customer made will be given to customers
after they order the dishes. So Total Points is placed in customer table.

• Customer (CustomerID(PK), CustomerName, CustomerContact, CustomerEmail,


CustomerLocation, TotalPoints)

Sonika Timsina 11
CC6001NI Advanced Database Systems Development

3.4. Final Tables


Customer (CustomerID(PK), CustomerName, CustomerContact, CustomerEmail,
CustomerLocation, TotalPoints)

Restaurant (RestaurantID(PK), RestaurantName, RestaurantAddress,


RestaurantContact)

Dish (DishCode(PK), DishName, LocalName)


OrderRegister (SN(PK), CustomerID(FK), DeliveryAddressID(FK), DateTime,
OrderNumber, OrderAmount, Status)

DeliveryAddress (DeliveryAddressID(PK), AddressName, Latitude, Longitude )

LoyaltyPoint (LoyaltyPointID(PK), Points, StartTime, EndTime)

Restaurant_Dish (RestaurantID(FK), DishCode(FK), DishRate, DishAvailability)

OrderTotal(SN(FK), RestaurantID(FK), DishCode(FK), OrderUnit, LineTotal,


TotalPoints)

DishLoyalty(Dish_Code(FK) , LoyaltyPointID(FK))

Sonika Timsina 12
CC6001NI Advanced Database Systems Development

4. Data Dictionary

Entity Column Primary Foreign


Column name Data type Length Nullable Unique
name description Key key

Id of the
customer to
uniquely
CustomerID NUMBER TRUE FALSE FALSE TRUE
identify
each
customer.

Name of
CustomerName the VARCHAR2 255 FALSE FALSE FALSE FALSE
customer

Contact
CustomerContact number of NUMBER 10 FALSE FALSE FALSE TRUE
Customer

Email
Customer address of
CustomerEmail VARCHAR2 255 FALSE FALSE TRUE TRUE
the
customer

Address of
CustomerLocation the VARCHAR2 255 FALSE FALSE FALSE FALSE
customer

Total
loyalty
points
customer
TotalPoints has gotten NUMBER FALSE FALSE TRUE FALSE
though all
orders the
person has
made.

• Restaurant

Sonika Timsina 13
CC6001NI Advanced Database Systems Development

Table 2: Restaurant Data-Dictionary

Entity Column Primary Foreign


Column name Data type Length Nullable Unique
name description Key key

Id of the
restaurant
to uniquely
RestaurantID NUMBER TRUE FALSE FALSE TRUE
identify
each
restaurant.

Name of
RestaurantName the VARCHAR2 255 FALSE FALSE FALSE FALSE
Restaurant restaurant

Location of
RestaurantAddress VARCHAR2 255 FALSE FALSE FALSE FALSE
restaurant

Contact of
RestaurantContact the NUMBER 10 FALSE FALSE FALSE TRUE
restaurant

• Dish
Table 3: Dish Data-Dictionary

Entity Column Primary Foreign


Column name Data type Length Nullable Unique
name description Key key

Unique id
DishCode NUMBER TRUE FALSE FALSE TRUE
of the dish.

Name of
Dish DishName VARCHAR2 255 FALSE FALSE FALSE FALSE
the dish

Another
LocalName name for VARCHAR2 255 FALSE FALSE TRUE FALSE
the dish

• OrderRegister

Sonika Timsina 14
CC6001NI Advanced Database Systems Development

Table 4: Order Data-Dictionary

Column Primary Foreign


Entity name Column name Data type Length Nullable Unique
description Key key

Unique id
SN of the NUMBER TRUE FALSE FALSE TRUE
order.

Id of the
customer
CustomerID NUMBER FALSE TRUE FALSE FALSE
who made
the order

Id of the
address of
DeliveryAddressID NUMBER FALSE TRUE FALSE FALSE
order
delivery

OrderRegister
The order
OrderNumber VARCHAR2 50 FALSE FALSE FALSE TRUE
number

Date and
DateTime time of the DATE FALSE FALSE FALSE FALSE
order

Total
OrderAmount amount of NUMBER FALSE FALSE FALSE FALSE
the order

Status of
Status VARCHAR2 255 FALSE FALSE FALSE FALSE
the order

• DeliveryAddress

Sonika Timsina 15
CC6001NI Advanced Database Systems Development

Table 5: DeliveryAddress Data-Dictionary

Column Primary Foreign


Entity name Column name Data type Length Nullable Unique
description Key key

Unique id
of the
DeliveryAddressID NUMBER TRUE FALSE FALSE TRUE
delivery
address.

Name of
the
AddressName VARCHAR2 50 FALSE FALSE FALSE FALSE
delivery
DeliveryAddress location

Latitude of
Latitude the VARCHAR2 50 FALSE FALSE FALSE FALSE
address

Longitude
Longitude of the VARCHAR2 50 FALSE FALSE FALSE FALSE
address

• LoyaltyPoint

Sonika Timsina 16
CC6001NI Advanced Database Systems Development

Table 6: LoyaltyPoint Data-Dictionary

Column Primary Foreign


Entity name Column name Data type Length Nullable Unique
description Key key

Unique id
of the
LoyaltyPointID NUMBER TRUE FALSE FALSE TRUE
loyalty
point.

Name of
the
Points NUMBER FALSE FALSE FALSE FALSE
delivery
location
LoyaltyPoint
Start time
of the
StartTime DATE FALSE FALSE FALSE FALSE
loyalty
point

End time
of the
EndTime DATE FALSE FALSE FALSE FALSE
loyalty
point

Sonika Timsina 17
CC6001NI Advanced Database Systems Development

• RestaurantDish
Table 7: RestaurantDish Data-Dictionary

Column Primary Foreign


Entity name Column name Data type Length Nullable Unique
description Key key

Id of the
RestaurantID NUMBER FALSE TRUE FALSE FALSE
restaurant.

Code of
DishCode VARCHAR2 50 FALSE TRUE FALSE FALSE
the dish.
RestaurantDish
Latitude of
DishRate the NUMBER FALSE FALSE FALSE FALSE
address

Availability
DishAvailability VARCHAR2 1 FALSE FALSE FALSE FALSE
of the dish

• OrderTotal

Sonika Timsina 18
CC6001NI Advanced Database Systems Development

Table 8: OrderTotal Data-Dictionary

Entity Column Primary Foreign


Column name Data type Length Nullable Unique
name description Key key

Id of the
SN NUMBER FALSE TRUE FALSE FALSE
order.

Id of the
RestaurantID NUMBER FALSE TRUE FALSE FALSE
restaurant

Id of the
DishCode NUMBER FALSE TRUE FALSE FALSE
dish

OrderTotal
Total units
OrderUnit NUMBER FALSE FALSE FALSE FALSE
ordered

Total price
LineTotal of the NUMBER FALSE FALSE FALSE FALSE
order

Total
points
TotalPoints gained NUMBER FALSE FALSE TRUE FALSE
from the
order

• DishLoyalty

Table 9: DishLoyalty Data Dictionary

Entity Column Primary Foreign


Column name Data type Length Nullable Unique
name description Key key

Unique id
DishCode NUMBER TRUE FALSE FALSE TRUE
of the dish.

Name of
Dish DishName VARCHAR2 255 FALSE FALSE FALSE FALSE
the dish

Another
LocalName name for VARCHAR2 255 FALSE FALSE TRUE FALSE
the dish

Sonika Timsina 19
CC6001NI Advanced Database Systems Development

5. Generation of Database
5.1. DDL Scripts
CREATE TABLE Customer
(
Customer_ID NUMBER,
Customer_Name VARCHAR2(50),
Customer_Contact NUMBER(10),
Customer_Email VARCHAR2(255),
Customer_Location VARCHAR2(255),
Total_Points NUMBER(10),
CONSTRAINT customer_pk PRIMARY KEY(Customer_ID),
CONSTRAINT contact_pk UNIQUE (Customer_Contact),
CONSTRAINT email_pk UNIQUE (Customer_Email)
);

create sequence customer_sequence


start with 1
increment by 1;
create or replace trigger customer_trigger
before insert on customer
for each row
begin
select customer_sequence.nextval into :new.customer_id from dual;
end;

Sonika Timsina 20
CC6001NI Advanced Database Systems Development

CREATE TABLE Restaurant


(
Restaurant_ID NUMBER,
Restaurant_Name VARCHAR2(255),
Restaurant_Address VARCHAR2(255),
Restaurant_Contact NUMBER(10),
CONSTRAINT restaurant_pk PRIMARY KEY(Restaurant_ID),
CONSTRAINT contact_unq UNIQUE (Restaurant_Contact)
);

create sequence restaurant_sequence


start with 1
increment by 1;
create or replace trigger restaurant_trigger
before insert on restaurant
for each row
begin
select restaurant_sequence.nextval into :new.restaurant_id from dual;
end;

Sonika Timsina 21
CC6001NI Advanced Database Systems Development

CREATE TABLE Dish


(
Dish_Code VARCHAR2(50),
Dish_Name VARCHAR2(255),
Local_Name VARCHAR2(255),
CONSTRAINT dish_pk PRIMARY KEY(Dish_Code)
);

CREATE TABLE Delivery_Address


(
Delivery_Address_ID NUMBER,
Address_Name VARCHAR2(50),
Latitude VARCHAR2(50),
Longitude VARCHAR2(50),
CONSTRAINT Delivery_Address_ID PRIMARY KEY (Delivery_Address_ID)
);

create sequence address_sequence


start with 1
increment by 1;
create or replace trigger address_trigger

Sonika Timsina 22
CC6001NI Advanced Database Systems Development

before insert on delivery_address


for each row
begin
select address_sequence.nextval into :new.delivery_address_id from dual;
end;

CREATE TABLE Order_Register


(
SN NUMBER,
Customer_ID NUMBER,
Delivery_Address_ID NUMBER,
Order_Number VARCHAR2(50),
Date_Time DATE,
Order_Amount NUMBER,
Status VARCHAR2(255),
CONSTRAINT order_pk PRIMARY KEY (SN),
CONSTRAINT order_no_unq UNIQUE (Order_Number),
FOREIGN KEY (Customer_ID) REFERENCES Customer(Customer_ID),
FOREIGN KEY (Delivery_Address_ID) REFERENCES
Delivery_Address(Delivery_Address_ID)
);

create sequence orderregister_sequence


start with 10
increment by 1;
create or replace trigger orderregister_trigger

Sonika Timsina 23
CC6001NI Advanced Database Systems Development

before insert on order_register


for each row
begin
select orderregister_sequence.nextval into :new.sn from dual;
end;

CREATE TABLE Loyalty_Point


(
Loyalty_Point_ID NUMBER,
Points VARCHAR2(50),
Start_Time DATE,
End_Time DATE ,
CONSTRAINT loyalty_pk PRIMARY KEY (Loyalty_Point_ID)
);

create sequence loyaltypoint_sequence


start with 1
increment by 1;
create or replace trigger loyaltypoint_trigger
before insert on loyalty_point
for each row
begin
select loyaltypoint_sequence.nextval into :new.loyalty_point_id from dual;
end;

Sonika Timsina 24
CC6001NI Advanced Database Systems Development

CREATE TABLE Restaurant_Dish


(
Restaurant_ID NUMBER,
Dish_Code VARCHAR2(50),
Dish_Rate NUMBER,
Dish_Availability VARCHAR2(1),
FOREIGN KEY (Restaurant_ID) REFERENCES Restaurant(Restaurant_ID),
FOREIGN KEY (Dish_Code) REFERENCES Dish(Dish_Code)
);

CREATE TABLE Order_Total


(
SN NUMBER,
Restaurant_ID NUMBER,
Dish_Code VARCHAR2(50),
Order_Unit NUMBER(20),
Line_Total NUMBER,
Total_Points NUMBER,

Sonika Timsina 25
CC6001NI Advanced Database Systems Development

FOREIGN KEY (SN) REFERENCES Order_Register(SN),


FOREIGN KEY (Restaurant_ID) REFERENCES Restaurant(Restaurant_ID),
FOREIGN KEY (Dish_Code) REFERENCES Dish(Dish_Code)
);

CREATE TABLE Dish_Loyalty


(
Dish_Code VARCHAR2(50),
Loyalty_Point_ID NUMBER,
FOREIGN KEY (Dish_Code) REFERENCES Dish(Dish_Code),
FOREIGN KEY (Loyalty_Point_ID) REFERENCES
Loyalty_Point(Loyalty_Point_ID)
);

Sonika Timsina 26
CC6001NI Advanced Database Systems Development

Figure 2: Customer table

Sonika Timsina 27
CC6001NI Advanced Database Systems Development

Figure 3: Restaurant table

Figure 4: Dish table

Sonika Timsina 28
CC6001NI Advanced Database Systems Development

Figure 5: Delivery Address table

Sonika Timsina 29
CC6001NI Advanced Database Systems Development

Figure 6: Order Register table

Sonika Timsina 30
CC6001NI Advanced Database Systems Development

Figure 7: Loyality Point table

Figure 8: Restaurant table

Sonika Timsina 31
CC6001NI Advanced Database Systems Development

Figure 9: Order table

Figure 10: Dish loyalty

Sonika Timsina 32
CC6001NI Advanced Database Systems Development

5.2. DML Scripts

Figure 11: Insert into customer

Figure 12: Insert into dish

Sonika Timsina 33
CC6001NI Advanced Database Systems Development

Figure 13: Insert into restaurant

Figure 14: Insert into Loyalty point

Sonika Timsina 34
CC6001NI Advanced Database Systems Development

Figure 15: Insert into delivery address

Figure 16: Insert into Restaurant dish

Sonika Timsina 35
CC6001NI Advanced Database Systems Development

Figure 17: Insert into order register

Figure 18: Insert into order total

Figure 19: Dish Loyalty

Sonika Timsina 36
CC6001NI Advanced Database Systems Development

5.3. Select statement


• Customer

• Restaurant

• Delivery_Address

Sonika Timsina 37
CC6001NI Advanced Database Systems Development

5.4. Entity Relationship Diagram


An ER diagram shows the relationship among entity sets. An entity set is a group
of similar entities and these entities can have attributes. In terms of DBMS, an entity
is a table or attribute of a table in database, so by showing relationship among tables
and their attributes, ER diagram shows the complete logical structure of a database.
Lets have a look at a simple ER diagram to understand this concept. (beginnersbook,
n.d.)

Figure 20: Entity relationship diagram

Sonika Timsina 38
CC6001NI Advanced Database Systems Development

Sonika Timsina 39
CC6001NI Advanced Database Systems Development

Sonika Timsina 40
CC6001NI Advanced Database Systems Development

6. Implementation of Web-based Database Application


Dashboard

Sonika Timsina 41
CC6001NI Advanced Database Systems Development

6.1. Basic Webforms


6.1.1. Dish Details

Sonika Timsina 42
CC6001NI Advanced Database Systems Development

6.1.2. Customer Details

6.1.3. RestaurantDetails

Sonika Timsina 43
CC6001NI Advanced Database Systems Development

6.1.4. Loyalty Points Details

Complex Webforms
6.1.5. Search

6.1.6. Customer Complex Form

Sonika Timsina 44
CC6001NI Advanced Database Systems Development

6.1.7. Order record

7. Testing

Test Delete Restaurant


Expected Output It should delete the restaurant information.

Actual Output It deleted the restaurant information.

Status Yes

Figure 21: Delete restaurant

Sonika Timsina 45
CC6001NI Advanced Database Systems Development

Test Add new dish

Expected Output It should add new dish.

Actual Output It added new dish.

Status Pass

Test Statement

Expected Output

Actual Output

Status

Sonika Timsina 46
CC6001NI Advanced Database Systems Development

Test Statement

Expected Output

Actual Output

Status

Test Statement

Expected Output

Actual Output

Status

Test Statement

Expected Output

Actual Output

Status

Sonika Timsina 47
CC6001NI Advanced Database Systems Development

8. References
beginnersbook. (n.d.) [Online]. Available from: https://beginnersbook.com/2015/04/e-
r-model-in-dbms/ [Accessed 2021].
javatpoint. (n.d.) javatpoint [Online]. Available from:
https://www.javatpoint.com/dbms-normalization [Accessed 2021].
oracle. (2021) Oracle [Online]. Available from:
https://www.oracle.com/database/what-is-database/.

Sonika Timsina 48

You might also like