Professional Documents
Culture Documents
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)
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:
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
Deletion Anomalies. It is a multi-step process that puts data into tabular form, removing
3.1. Figure 1
UNF gives us all attributes of entity Dish from the above figure 1 along with the
repeating groups and repeating data.
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.
Sonika Timsina 3
CC6001NI Advanced Database Systems Development
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,
Sonika Timsina 4
CC6001NI Advanced Database Systems Development
Sonika Timsina 5
CC6001NI Advanced Database Systems Development
3.2. Figure 2
Since, this table doesn’t have any composite key there is no any partial dependency.
SN →
Sonika Timsina 6
CC6001NI Advanced Database Systems Development
SN, RestaurantID →
SN →
SN, RestaurantID →
SN, DishCode →
DishCode → DishName
Sonika Timsina 7
CC6001NI Advanced Database Systems Development
Sonika Timsina 8
CC6001NI Advanced Database Systems Development
Integrating between tables from Figure 1 and Figure 2, then the final tables are,
(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.)
Sonika Timsina 9
CC6001NI Advanced Database Systems Development
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.
c) Delivery Address
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.
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.
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.
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.
Sonika Timsina 11
CC6001NI Advanced Database Systems Development
DishLoyalty(Dish_Code(FK) , LoyaltyPointID(FK))
Sonika Timsina 12
CC6001NI Advanced Database Systems Development
4. Data Dictionary
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
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
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
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
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
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
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
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
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)
);
Sonika Timsina 20
CC6001NI Advanced Database Systems Development
Sonika Timsina 21
CC6001NI Advanced Database Systems Development
Sonika Timsina 22
CC6001NI Advanced Database Systems Development
Sonika Timsina 23
CC6001NI Advanced Database Systems Development
Sonika Timsina 24
CC6001NI Advanced Database Systems Development
Sonika Timsina 25
CC6001NI Advanced Database Systems Development
Sonika Timsina 26
CC6001NI Advanced Database Systems Development
Sonika Timsina 27
CC6001NI Advanced Database Systems Development
Sonika Timsina 28
CC6001NI Advanced Database Systems Development
Sonika Timsina 29
CC6001NI Advanced Database Systems Development
Sonika Timsina 30
CC6001NI Advanced Database Systems Development
Sonika Timsina 31
CC6001NI Advanced Database Systems Development
Sonika Timsina 32
CC6001NI Advanced Database Systems Development
Sonika Timsina 33
CC6001NI Advanced Database Systems Development
Sonika Timsina 34
CC6001NI Advanced Database Systems Development
Sonika Timsina 35
CC6001NI Advanced Database Systems Development
Sonika Timsina 36
CC6001NI Advanced Database Systems Development
• Restaurant
• Delivery_Address
Sonika Timsina 37
CC6001NI Advanced Database Systems Development
Sonika Timsina 38
CC6001NI Advanced Database Systems Development
Sonika Timsina 39
CC6001NI Advanced Database Systems Development
Sonika Timsina 40
CC6001NI Advanced Database Systems Development
Sonika Timsina 41
CC6001NI Advanced Database Systems Development
Sonika Timsina 42
CC6001NI Advanced Database Systems Development
6.1.3. RestaurantDetails
Sonika Timsina 43
CC6001NI Advanced Database Systems Development
Complex Webforms
6.1.5. Search
Sonika Timsina 44
CC6001NI Advanced Database Systems Development
7. Testing
Status Yes
Sonika Timsina 45
CC6001NI Advanced Database Systems Development
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