0% found this document useful (0 votes)
1K views87 pages

Database Coursework Islington College

Uploaded by

rijan paudel
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)
1K views87 pages

Database Coursework Islington College

Uploaded by

rijan paudel
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/ 87

CC5051NI Databases

50% Individual Coursework

Autumn 2023

Student Name: Rijan Paudel


London Met ID: 22067807
Assignment Submission Date: Monday, January 15, 2024
Word Count: 8805

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 mark of zero will be awarded.
Acknowledgement

I want to express my appreciation to Module Leader Yunisha Bajracharya, Lecturer


Aadesh Tandukar, and Tutor Ujjwal Adhikari for their constant support throughout the
Database module and assignment. Their guidance made the learning process more
accessible and enjoyable. Equally, my heartfelt thanks go to my friends who played a
crucial role in enhancing my understanding of database concepts. Their collaborative
efforts and willingness to help made the assignment very manageable. I’m very grateful
for this collective support, making the learning journey smoother and more fulfilling.
Table of Contents

Acknowledgement ........................................................................................................... 2
1. Introduction .............................................................................................................. 1
1.1 Aims and Objectives .......................................................................................... 2
1.1.1 Aim .............................................................................................................. 2
1.1.2 Objectives .................................................................................................... 3
1.2 Current Business Activities and Operations ....................................................... 4
1.3 Business Rules .................................................................................................. 5
1.4 Assumptions....................................................................................................... 7
1.5 Identification of Entities and Attributes ............................................................... 8
1.5.1 Customer......................................................................................................... 8
1.5.2 Vendor ......................................................................................................... 9
1.5.3 Orders........................................................................................................ 10
1.5.4 Product ...................................................................................................... 11
2. Initial ERD .............................................................................................................. 12
2.1 Entity and Attributes ......................................................................................... 12
2.2 Initial Entity Relationship Diagram ....................................................................... 13
3. Normalization ......................................................................................................... 15
3.1. Un-Normalized Form (UNF) ................................................................................ 15
3.2 First Normal Form (1NF) .................................................................................. 17
3.3 Second Normal Form (2NF) ............................................................................. 19
3.4 Third Normal From (3NF) ................................................................................. 21
4. Final ERD ............................................................................................................... 24
5. Implementation....................................................................................................... 27
5.1 Creation of user................................................................................................ 27
5.2 Creating and Desribing the tables .................................................................... 28
5.2.1 Creating Customer table. .............................................................................. 28
5.2.2 Describing Customer table. ....................................................................... 29
5.2.3 Creating Vendor table ................................................................................ 30
5.2.4 Describing Vendor table ............................................................................ 31
5.2.5 Creating Payment table. ............................................................................ 32
5.2.6 Describing Payment table. ......................................................................... 33
5.2.7 Creating Product table. .............................................................................. 34
5.2.8 Describing Product table............................................................................ 35
5.2.9 Creating Orders table. ............................................................................... 36
5.2.10 Describing Orders table. ......................................................................... 37
5.2.11 Creating Order_Product table................................................................. 38
5.2.12 Describing Order_Product table ............................................................. 39
5.3 Data Insertion and Display Inserted Data. ........................................................ 40
5.3.1 Inserting values in Customer table. ............................................................... 40
5.3.2 Displaying all data of Customer table. ....................................................... 41
5.3.3 Inserting values in Vendor table. ............................................................... 42
5.3.4 Displaying all data of Vendor table. ........................................................... 43
5.3.5 Inserting values in Payment table. ............................................................. 44
5.3.6 Displaying all data of Payment table. ......................................................... 45
5.3.7 Inserting values in Product table. ............................................................... 46
5.3.8 Displaying all data of Product table. .......................................................... 47
5.3.9 Inserting values in Orders table. ................................................................ 48
5.3.10 Displaying all data of Orders table.......................................................... 49
5.3.11 Inserting values in Order_Product table. ................................................ 50
5.3.12 Displaying all data of Order_Product table. ............................................ 51
6. Database Querying ................................................................................................ 52
6.1 Information Query ............................................................................................ 52
6.2 Transaction Query ............................................................................................... 57
7. Critical Evaluation .................................................................................................. 62
7.1 Critical Evaluation of module, its usage and relation with other subject ........... 62
7.2 Critical Assessment of coursework .................................................................. 63
8. Database Dump File Creation ................................................................................ 64
9. Spool File Creation................................................................................................. 65
9.1 Spool File Creation of Information Query 1. ..................................................... 65
9.2 Spool File Creation of Information Query 2. ..................................................... 66
9.3 Spool File Creation of Information Query 3. ..................................................... 67
9.4 Spool File Creation of Information Query 4. ..................................................... 68
9.5 Spool File Creation of Information Query 5. ..................................................... 69
9.6 Spool File Creation of Transaction Query 1. .................................................... 70
9.7 Spool File Creation of Transaction Query 2. .................................................... 71
9.8 Spool File Creation of Transaction Query 3. .................................................... 72
9.9 Spool File Creation of Transaction Query 4. .................................................... 73
9.10 Spool File Creation of Transaction Query 5. ................................................. 74
10. Drop Query .......................................................................................................... 75
10.1 Dropping Order_Product Table. ......................................................................... 75
10.2 Dropping Product Table. .................................................................................... 75
10.3 Dropping Vendor Table. ..................................................................................... 76
10.4 Dropping Orders Table. ..................................................................................... 76
10.5 Dropping Payment Table. .................................................................................. 77
10.6 Dropping Customer Table. ................................................................................. 77
10.7 Showing that all Tables are dropped. ................................................................ 77
11. Conclusion........................................................................................................... 78
12. References .......................................................................................................... 79
Table of Figures

Figure 2: Intial ERD ....................................................................................................... 13


Figure 3: Final ERD. ...................................................................................................... 24
Figure 4: Screenshot of creating user, granting connect and resource and connecting to
the user. ........................................................................................................................ 27
Figure 5: Screenshot of Creating Customer table. ........................................................ 28
Figure 6: Screenshot of Describing Customer table. ..................................................... 29
Figure 7: Screenshot of Creating Vendor table. ............................................................ 30
Figure 8: Screenshot of Describing Vendor table. ......................................................... 31
Figure 9: Screenshot of Creating Payment table. .......................................................... 32
Figure 10: Screenshot of Describing Payment table. .................................................... 33
Figure 11: Screenshot of Creating Product table. ......................................................... 34
Figure 12: Screenshot of describing Product table. ....................................................... 35
Figure 13: Screenshot of Creating Orders table. ........................................................... 36
Figure 14: Screenshot of Describing Orders table. ....................................................... 37
Figure 15: Screenshot of Creating Order_Product table. .............................................. 38
Figure 16: Screenshot of describing Order_Product table............................................. 39
Figure 17: Screenshot of inserting values in Customer table. ....................................... 40
Figure 18: Screenshot of displaying all data of Customer table using SELECT *
command. ..................................................................................................................... 41
Figure 19: Screenshot of inserting values in Vendor table. ........................................... 42
Figure 20: Screenshot of displaying all data of Vendor table using SELECT * command.
...................................................................................................................................... 43
Figure 21: Screenshot of inserting values in Payment table. ......................................... 44
Figure 22: Screenshot of displaying all data of Payment table with SELECT * command.
...................................................................................................................................... 45
Figure 23: Screenshot of inserting values in Product table. .......................................... 46
Figure 24: Screenshot of displaying all data of Product table with SELECT * command.
...................................................................................................................................... 47
Figure 25: Screenshot of inserting values in Orders table. ............................................ 48
Figure 26: Screenshot of displaying all data of Orders table with SELECT * command.
...................................................................................................................................... 49
Figure 27: Screenshot of inserting values in Order_Product table. ............................... 50
Figure 28: Screenshot of displaying all data of Order_Product table. ........................... 51
Figure 29: Query to list all customers that are staff of the company. ............................. 52
Figure 30: Query to list all the orders between the mentioned date. ............................. 53
Figure 31: Query to list all customers with order details and also the customers who
have not ordered yet. .................................................................................................... 54
Figure 32: Query to list all the products with second letter 'a' in product name and have
stock quantity more than 50. ......................................................................................... 55
Figure 33: Query to list the customer who has ordered recently. .................................. 56
Figure 34: Query to show total revenue of company for each month. ........................... 57
Figure 35: Query to find those orders that are equal or higher than average order total
value.............................................................................................................................. 58
Figure 36: Query to list details of vendors who have supplied more than 3 products. ... 59
Figure 37: Query to show top 3 product details that were ordered the most. ................ 60
Figure 38: Query to find customer who has most ordered the most in August with his/her
total spending of that month. ......................................................................................... 61
Figure 39: Screenshot of Creating Dump file in cmd. .................................................... 64
Figure 40: Screenshot of creating spool file of information query number 1.................. 65
Figure 41: Screenshot of creating spool file of information query number 2.................. 66
Figure 42: Screenshot of creating spool file of information query number 3.................. 67
Figure 43: Screenshot of creating spool file of information query number 4.................. 68
Figure 44: Screenshot of creating spool file of information query number 5.................. 69
Figure 45: Screenshot of creating spool file of transaction query number 1. ................. 70
Figure 46: Screenshot of creating spool file of transaction query number 2. ................. 71
Figure 47: Screenshot of creating spool file of transaction query number 3. ................. 72
Figure 48: Screenshot of creating spool file of transaction query number 4. ................. 73
Figure 49: Screenshot of creating spool file of transaction query number 5. ................. 74
Figure 50: Screenshot of Dropping Order_Product Table. ............................................ 75
Figure 51: Screenshot of Dropping Product table. ........................................................ 75
Figure 52: Screenshot of Dropping Vendor Table. ........................................................ 76
Figure 53: Screenshot of Dropping Orders Table. ......................................................... 76
Figure 54: Screenshot of Dropping Payment Table. ..................................................... 77
Figure 55: Screenshot of Dropping Customer Table. .................................................... 77
Table of Tables
Table 1: Identification of Entities and Attributes of Customer table. ................................ 8
Table 2: Identification of Entities and Attributes of Vendor table. .................................... 9
Table 3: Identification of Entities and Attributes of Orders table. ................................... 10
Table 4: Identification of Entities and Attributes of Product table. ................................. 11
Table 5: List of Entities and Attributes. .......................................................................... 12
CC5051NI Databases

1. Introduction

Mr. John, an enthusiast in both entrepreneurship and electronics, is gearing up to launch


"Gadget Emporium," an exciting online store dedicated to electronic devices and
accessories. The vision behind this venture is to provide a wide array of cutting-edge
electronic products, addressing to the needs of individual consumers and businesses
alike. As the designated database designer, the primary goal is to assist Mr. John in
creating a robust system that seamlessly manages customer information, product details,
and order processing.

The focus of "Gadget Emporium" lies in simplicity and efficiency. The proposed
system aims to simplify product management, categorize customers into Regular, Staff,
and VIP with corresponding discounts, facilitate smooth order processing, manage
vendor relationships, monitor real-time product availability, and offer diverse payment
options. The business rules highlight the emphasis on delivering a user-friendly
experience, where customers can easily browse, purchase, and enjoy the convenience
of secure payment methods.

The proficiency of this online marketplace lies in its commitment to providing a


hassle-free and enjoyable shopping experience for customers while offering a wide
selection of electronic gadgets. The implementation of a robust database system is
envisioned to enhance operational efficiency, ensuring that "Gadget Emporium" becomes
a go-to destination for electronic enthusiasts and businesses seeking quality products in
the online retail landscape.

1
CC5051NI Databases

1.1 Aims and Objectives

1.1.1 Aim

The aim of implementing the database system for "Gadget Emporium" is to create a
robust platform that efficiently manages electronic gadgets and accessories. The
system will focus on key business rules, ensuring effortless product management,
customer categorization, order processing, vendor management, real-time inventory
tracking, payment processing, and invoicing.

This database aims to serve as the backbone of the e-commerce operations,


providing a centralized and organized system for storing, tracking, and managing all
data related to customers, products, and orders. By precisely handling electronic
product details, customer categories, and order specifics, the database contributes to
the smooth functioning of "Gadget Emporium's" online marketplace.

Additionally, the database will play a crucial role in maintaining accurate stock
levels, preventing overselling, and facilitating secure transactions through various
payment gateways. Each order detail will be captured comprehensively, including the
necessary customer and payment information, along with applicable discounts.

2
CC5051NI Databases

1.1.2 Objectives

i. To organize electronic gadgets and accessories with details such as names,


descriptions, categories, prices, and stock levels.

ii. To maintain comprehensive customer records, including details about their


category (Regular, Staff, VIP), address, and discount rates.

iii. To record and manage order details, including purchased products, quantities,
unit prices, and total order amounts.

iv. To manage vendor records for suppliers of electronic gadgets and associate
each product with a specific vendor.

v. To monitor and update product availability in real-time to prevent overselling and


maintain accurate stock levels.

vi. To integrate with various payment gateways to ensure secure and seamless
transactions for each order.

vii. To generate invoices automatically upon customer order confirmation,


incorporating order details, customer information, and payment details (with
applicable discounts).

3
CC5051NI Databases

1.2 Current Business Activities and Operations

Gadget Emporium, an online electronics store, provides customers with a wide variety of
electronic devices and accessories. The platform offers a smooth experience for both
individual consumers and businesses, facilitating the purchase of electronic gadgets with
ease. The business focuses on precise product management, ensuring accurate details
such as product names, descriptions, categories, prices, and real-time stock levels.
Customers, categorized as Regular, Staff, or VIP, enjoy varying discount rates on
purchases, enhancing the appeal of the platform. The order processing system allows
customers to browse, select, and purchase multiple electronic gadgets online, with each
order systematically recorded, including product details, quantities, unit prices, and total
order amounts. Vendor management is a key aspect, maintaining records of vendors
associated with each product. Real-time inventory management prevents overselling and
ensures product availability. The integrated payment processing system offers secure
transactions through multiple gateways, including cash on delivery, credit/debit cards, or
e-wallets. Upon order confirmation, the system generates an invoice detailing the order,
customer information, and applicable discounts.

4
CC5051NI Databases

1.3 Business Rules

• Managing Products: The system is designed to handle the specifics of electronic


gadgets and accessories, encompassing details such as product names, descriptions,
categories, prices, and stock levels. Each product is assigned to a single category,
and each category can encompass one or multiple products.

• Customer Categorization and Discounts: The system ensures comprehensive


tracking of all customers, categorizing them as Regular (R), Staff (S), or VIP (V), with
varying discount rates for product purchases (0%, 5%, and 10% respectively).
Additionally, customer addresses are stored to facilitate efficient delivery processes.

• Processing Orders: Customers have the flexibility to browse and buy one or more
electronic gadgets online. The system records detailed information for each order,
including the purchased products, quantities, unit prices, and the total order amount.
Orders may consist of multiple products, and a single product type might be part of
various orders placed by different customers.

• Managing Vendors: The system maintains comprehensive records of vendors or


suppliers providing electronic gadgets and accessories. Each product is linked to a
specific vendor, and a vendor can supply one or more products.

• Product Availability and Inventory Management: Real-time tracking of product


availability is implemented to prevent overselling and ensure accurate stock levels.
Each product includes inventory details like stock quantity or availability status.

5
CC5051NI Databases

• Processing Payments: The system seamlessly integrates with various payment


gateways to ensure secure and smooth transactions for each order. Payment options
encompass cash on delivery, credit/debit cards, or e-wallets, with each order detail
having a designated payment option.

• Generating Invoices: Upon customer order confirmation and checkout, the system
automatically generates invoices containing comprehensive details of the order,
customer information, and payment specifics, including applicable discounts.

6
CC5051NI Databases

1.4 Assumptions

The following assumptions are made according to the business rule: -

• A product's category is exclusive, meaning it belongs to only one category, and


categories can have one or more associated products.

• All customers must be categorized into one of the defined categories (Regular, Staff,
VIP).

• An order can consist of multiple products, allowing customers to purchase various


items in a single transaction.

• Products can appear in multiple orders, suggesting that there is no restriction on a


product being ordered by different customers.

• Each product is associated with a single vendor, and each vendor can supply many
products.

• Real-time product availability tracking implies a dynamic inventory that is updated with
each transaction.

• Inventory details include stock quantity, assuming a mechanism to prevent


overselling.

• The system supports various payment gateways, providing flexibility for customers to
choose their preferred payment method.

• Each order requires a single payment option, ensuring clarity in the payment process
for each transaction.

7
CC5051NI Databases

1.5 Identification of Entities and Attributes

1.5.1 Customer

Attributes Data Type Constraints Description

Customer_ID NUMBER (5) PRIMARY KEY, This field records the


UNIQUE
unique ID assigned to
each customers.
Customer_Name VARCHAR2 (25) NOT NULL This fields records the
name of each customer.
Customer_Address VARCHAR2 (25) NOT NULL This field records the
address of customer,
which will be used while
delivery.
Customer_PhoneNumber NUMBER (12) NOT NULL This field records the
phone number of each
customer.
Customer_Email VARCHAR2 (31) NOT NULL This field records the email
of each customer.
Customer_Category VARCHAR2 (17) NOT NULL This field records the
category of customer i.e
Regular, Staff and VIP
Discount_Rate VARCHAR2 (13) NOT NULL This field records the
discount rate given to each
customer on the basis of
their category.
Table 1: Identification of Entities and Attributes of Customer table.

8
CC5051NI Databases

1.5.2 Vendor

Attributes Data Type Constraints Description

Vendor_ID NUMBER (5) PRIMARY KEY, This field records the


UNIQUE
unique ID assigned to
each vendor.
Vendor_Name VARCHAR2 (24) NOT NULL This field records the
name of each vendor.
Vendor_PhoneNumber NUMBER (12) NOT NULL This field records the
phone number of each
vendor.
Vendor_Email VARCHAR2 (27) NOT NULL This field records the
email address of vendor.
Vendor_Address VARCHAR2 (16) NOT NULL This field records the
address of vendor.
Table 2: Identification of Entities and Attributes of Vendor table.

9
CC5051NI Databases

1.5.3 Orders

Attributes Data Type Constraints Description

Order_ID NUMBER (5) PRIMARY KEY, This field records the unique ID
UNIQUE
assigned to each orders.

Order_Quantity NUMBER (5) NOT NULL This field records the amount of
products in the order.

Unit_Price NUMBER (11) NOT NULL This field records the unit price of
each product.

Total_Amount NUMBER (11) NOT NULL This field records the total amount
before discount.
Discount_Amount NUMBER (10) NOT NULL This field records the amount of
discount given to the order.
Final_Amount NUMBER (11) NOT NULL This field records the final amount
after discount.
Order_Date DATE NOT NULL This field records the
Ordered date of each order.
Customer_ID NUMBER (5) FOREIGN KEY This field records the unique ID of
customer which has given the order.
Payment_ID VARCHAR2 FOREIGN KEY This field records the unique ID of
(10)
each payment.

Payment_Option VARCHAR2 NOT NULL This field records the payment


(16)
method of the order.
Table 3: Identification of Entities and Attributes of Orders table.

10
CC5051NI Databases

1.5.4 Product

Attributes Data Type Constraints Description

Product_ID NUMBER (5) PRIMARY KEY, This field records the


UNIQUE
unique ID assigned to
each products.
Product_Name VARCHAR2 (29) NOT NULL This field records the
name of each
product.
Product_Description VARCHAR2 (35) NOT NULL This field records the
description of the
product.
Product_Category VARCHAR2 (16) NOT NULL This field records the
category of each
product.
Product_Price NUMBER (11) NOT NULL This field records the
price of a product,
Stock_Quantity NUMBER (5) NOT NULL This field records the
stock quantity
available of that
product,
Order_ID NUMBER (5) FOREIGN KEY This field records the
Unique ID assigned to
Order.
Vendor_ID NUMBER (5) FOREIGN KEY This field records the
unique ID of vendor.

Table 4: Identification of Entities and Attributes of Product table.

11
CC5051NI Databases

2. Initial ERD

2.1 Entity and Attributes

An entity is defined as an actual object or element existing in the tangible world, such as
a customer, car, or pen. These entities are stored within the database and need to be
discernible, ensuring they can be readily identified within a group (Point, 2023).

An attribute serves as a property or distinctive aspect of an entity, and entities can


encompass a diverse array of attributes. One among these attributes holds the
designation of being the primary key. In the context of an Entity-Relation model, attributes
are visually represented using elliptical shapes (Geeksforgeeks, 2023).

Entities Attributes

Customer Customer_ID (PK), Customer_Name, Customer_Address,


Customer_PhoneNumber, Customer_Email, Customer_Category,
Discount_Rate
Order Order_ID (PK), Order_Quantity, Unit_Price, Total_Amount,
Discount_Amount, Final_Amount, Order_Date, Payment_ID,
Payment_Option, Customer_ID (FK)
Product Product_ID (PK), Product_Name, Product_Description,
Product_Category, Product_Price, Stock_Quantity, Vendor_ID (FK),
Order_ID (FK)
Vendor Vendor_ID (FK, Vendor_Name, Vendor_PhoneNumber,
Vendor_Email, Vendor_Address
Table 5: List of Entities and Attributes.

12
CC5051NI Databases

2.2 Initial Entity Relationship Diagram

Figure 1: Intial ERD

The initial ERD shows the relationship between the customer, order, product, and vendor
tables. The customer table contains information about the customer's name, address,
phone number, and email. The order table contains information about the order's date,
total amount, and payment information. The product table contains information about the
product's name, description, and price. The vendor table contains information about the
vendor's name, address, phone number, and email. The customer table and order table
has one to many relationship while order being optional as each customer can have
multiple orders and each order has one customer but customer can or cannot have order.
The order table and product table has many to many relationship as multiple order can
have multiple products and vice versa. The product table and vendor table have one to

13
CC5051NI Databases

many relationship as each vendor can sell multiple order and each product has one
vendor.

14
CC5051NI Databases

3. Normalization

Normalization is the process of organizing data in a database by creating tables and


establishing relationships between those tables according to rules designed both to
protect the data and to make the database more flexible by eliminating redundancy and
inconsistent dependency (Microsoft, 2023). It also removes the different anamolies like
insertion, updation and deletion. The origin of the concept of database normalization is
commonly attributed to E.F. Codd, an IBM researcher who introduced it in 1970. Usually
in normalization process, database is normalized in different forms like
1NF,2NF,3NF,4NF etc. For our coursework we have only done normalization to 3NF for
simplicity. The following are the step wise normalization starting from UNF to 3NF :-

3.1. Un-Normalized Form (UNF)

In Unnormalized Form, the data in database are nor normalized which means they have
data redundancies, inconsistencies, repeating columns and all types of anamolies.

Process

Order - (Order_ID(PK), Order_Quantity, Unit_Price, Total_Amount, Discount_Amount,


Final_Amount, Order_Date, Payment_ID, Payment_Option, Customer_ID,
Customer_Name, Customer_Address, Customer_PhoneNumber, Customer_Email,
Customer_Category, Discount_Rate, {Product_ID, Product_Name,
Product_Description, Product_Category, Product_Price, Stock_Quantity, Vendor_ID,
Vendor_Name, Vendor_PhoneNumber ,Vendor_Email, Vendor_Address})

15
CC5051NI Databases

Description

The provided information describes data in Unnormalized Form within a database,


indicating the presence of data redundancies, inconsistencies, and anomalies. The
process involves an order entity with various attributes such as order quantity, unit price,
total amount, and more. The description outlines a structure including order details,
customer information, product details, and vendor information, illustrating potential data-
related issues. The curly bracket indicates repeating groups in Order table.

16
CC5051NI Databases

3.2 First Normal Form (1NF)

The concept of the first normal form (1NF) establishes foundational principles for
organizing relational databases and specifically applies to individual tables within the
database system. In first normal form, the repeating group or columns are eliminated by
creating different table for it.

Rules for 1NF

The following outlines the rules for first normal form:-

• All columns in the table must have unique values.

• Create separate tables for each distinct set of related data.

• Identify each table with a unique column or a combination of columns known as the
primary key.

• Avoid duplicating rows in tables.

• Avoid duplicating columns in tables.

• Eliminate null values from intersections of rows and columns.

• Eliminate multivalued fields from intersections of rows and columns.

17
CC5051NI Databases

Process

• Removing repeating columns

Order - 1 -(Order_ID(PK), Order_Quantity, Unit_Price, Total_Amount, Discount_Amount,


Final_Amount, Order_Date, Payment_ID, Payment_Option, Customer_ID,
Customer_Name, Customer_Address, Customer_PhoneNumber, Customer_Email,
Customer_Category, Discount_Rate)

Product - 1 - (Product_ID(PK), Order_ID(FK), Product_Name, Product_Description,


Product_Category, Product_Price, Stock_Quantity, Vendor_ID, Vendor_Name,
Vendor_PhoneNumber, Vendor_Email, Vendor_Address)

Description

In the first normal form (1NF), repeating columns have been removed to ensure data
integrity. Since the Order table in UNF has repeating group i.e Product information, it is
ensured that Product table is defined as another table by having Order_ID as foreign key.
The "Order" table includes essential order details, while the "Product" table is related to
orders and focuses on product information. Each table has a primary key (Order_ID for
"Order" and Product_ID for "Product"), ensuring uniqueness and setting the foundation
for proper database organization.

18
CC5051NI Databases

3.3 Second Normal Form (2NF)

The Second Normal Form eliminates the partial dependency on primary key, which
means the non-key attributes should be fully functional dependent on primary key and no
partial dependency should exist.

Rules for 2NF

The following outlines the rules for 2NF:

• The table should be in first normal form.

• There should be no any partial dependency on primary key.

• All non-prime attributes should be fully dependent on entire primary key.

Process

• Removing Partial Dependencies


• There is no any partial dependencies in Order table since all non-prime attributes in
Order table in fully dependent in Order_ID.
• Order_ID X (In Product table, not any non-key attrbute is dependent with
Order_ID)
• Order_ID, Product_ID X (In Product table, not any non-key attribute is
dependent with both combination of Order_ID and Product_ID)
• Product_ID Product_Name, Product_Description, Product_Category,
Product_Price, Stock_Quantity, Vendor_ID, Vendor_Name, Vendor_PhoneNumber,
Vendor_Email, Vendor_Address (In product table the following non-key attributes are
depedent with Product_ID)

19
CC5051NI Databases

So

Order - 2 - (Order_ID(PK), Order_Quantity, Unit_Price, Total_Amount, Discount_Amount,


Final_Amount, Payment_ID, Payment_Option, Customer_ID, Customer_Name
,Customer_Address, Customer_PhoneNumber, Customer_Email, Customer_Category)

Product_Order - 2 - (Product_ID (PK, FK), Order_ID (PK, FK))

Product - 2 - Product_ID(PK), Product_Name, Product_Description, Product_Category


,Product_Price, Stock_Quantity, Vendor_ID, Vendor_Name, Vendor_PhoneNumber,
Vendor_Email, Vendor_Address)

Description

In achieving Second Normal Form (2NF), it is ensured that non-key attributes are fully
dependent on the primary key without any partial dependencies. In Product table all non-
key attributes were only dependent in Order_ID and existence of Product_ID causes
partial dependency in that table. So to remove the parital dependenct bridge table
Order_Product is created between the "Order" and "Product" tables. This bridge table
includes a composite primary key consisting of both the "Product_ID" and "Order_ID,"
ensuring a unique identifier for each combination. By doing so, it establishes a clear
relationship, avoiding partial dependencies and providing an organized structure where
non-key attributes in both the "Order" and "Product" tables are fully dependent on their
respective primary keys, leading to a 2NF-compliant database design.

20
CC5051NI Databases

3.4 Third Normal From (3NF)

The third normal form eliminates the transitive dependencies in the database which
means that no non-primary key attribute has transitively dependent relationships to
the primary key. If A -----> B and B -----> C that means C is transitively dependent on
A, so that transitive dependency is eliminated by making different table for it in 3NF
which helps to improve data consistency and redundancy and to remove all kinds of
anamolies.

Rules for 3NF

The following outlines the rules for 3NF: -

• The table should be in second normal form.

• No non-key attribute should be transitively dependent on primary key.

Process

• Removing the transitive dependencies

• Order_ID Customer_ID Customer_Name, Customer_Address


,Customer_PhoneNumber, Customer_Email, Customer_Category (All the non-key
attributes which is given by Customer_ID are transitively dependent on Order_ID, so
this dependecy should be eliminated by making different table for Customer.)

• Order_ID Payment_ID Payment_Option (Payment_Option is


transitively dependent with Order_ID, so this dependency is eliminated by making
different table for Payment)

21
CC5051NI Databases

• Product_ID Vendor_ID Vendor_Name, Vendor_PhoneNumber,


Vendor_Email, Vendor_Address (All the non-key attributes which is given by
Vendor_ID are transitively dependent on Product_ID, so this dependecy should be
eliminated by making different table for Vendor.)

So

Order – 3 - (Order_ID (PK), Customer_ID (FK), Payment_ID (FK), Order_Quantity,


Unit_Price, Total_Amount, Discount_Amount, Final_Amount, Order_Date)

Order_Product – 3 - (Order_ID (PK, FK), Product_ID (PK, FK))

Customer – 3 - (Customer_ID(PK), Customer_Name, Customer_Address,


Customer_PhoneNumber, Customer_Email, Customer_Category, Discount_Rate)

Payment – 3 - (Payment_ID(PK), Payment_Option)

Product – 3 - (Product_ID(PK), Vendor_ID(FK), Product_Name, Product_Description,


Product_Category, Product_Price, Stock_Quantity,)

Vendor – 3 - (Vendor_ID(PK), Vendor_Name, Vendor_PhoneNumber, Vendor_Email,


Vendor_Address)

22
CC5051NI Databases

Description
In the transition to Third Normal Form (3NF), the primary objective is to eliminate transitive
dependencies, ensuring that non-primary key attributes do not have indirect relationships
with the primary key. This process involves recognizing instances where attributes like
Customer_Name, Customer_Address, Customer_PhoneNumber, and Customer_Email
were transitively dependent on Order_ID. To adjust this, a distinct "Customer" table was
established with Customer_ID as the primary key. Additionally, Payment_Option, found
to be transitively dependent on Order_ID, led to the creation of a separate "Payment"
table, with Payment_ID serving as the primary key. This restructuring enhances data
consistency, reduces redundancy, and ensures that each table aligns with the principles
of the Third Normal Form.

23
CC5051NI Databases

4. Final ERD

The final Entity Relationship Diagram represents the relationship diagram after the
normalization process.

Figure 2: Final ERD.

In the finalized Entity-Relationship Diagram (ERD) following the normalization process,


the visual representation precisely outlines the essential entities and their
interconnections within the database. The comprehensive design prioritizes the reduction
of redundancy and the fortification of data integrity, ensuring a robust foundation for
efficient data management. A detailed exploration of the key components of this ERD
reveals a structured framework that encapsulates various entities and their relationships.

24
CC5051NI Databases

Firstly, the core entities are identified:

• Orders: This entity serves as a repository for individual orders, covering crucial details
such as order quantity, unit price, discounts, final amounts, order dates, customer IDs,
and payment IDs.

• Products: Having comprehensive product information, this entity includes details like
product names, descriptions, categories, prices, final amounts, and stock quantities.

• Customers: Profiling customers, this entity stores relevant information such as names,
addresses, phone numbers, emails, categories, and applicable discount rates.

• Payments: This entity records diverse payment methods, featuring unique IDs and
associated payment options.

• Vendors: Managing vendor information, this entity includes details such as vendor
IDs, names, contact information, and addresses.

• Order Products: Functioning as a bridge entity, it establishes connections between


orders and their associated products, specifying the inclusion of products in each
order.

25
CC5051NI Databases

Secondly, the relationships between these entities are articulated:

• Orders and Products: The "Order Product" table illustrates that a single order can
involve multiple products, mapping Order IDs to corresponding Product IDs.

• Orders and Customers: Each order is linked to a specific customer, as denoted by the
foreign key "Customer ID" within the Order table.

• Orders and Payments: Each order corresponds to a singular payment method, as


indicated by the foreign key "Payment ID" within the Order table.

• Products and Vendors: The association between products and vendors is established
through the foreign key "Vendor ID" within the Product table.

Furthermore, the ERD has undergone normalization to optimize data organization and
integrity. This process strategically eliminates redundancy and reduces inconsistencies,
ensuring that data is stored both efficiently and accurately. The inclusion of primary keys
(PKs) for each entity guarantees a unique identifier for records, facilitating precise data
retrieval and modification. Foreign keys (FKs) sustains connections between related
entities, enhancing consistency and avoiding errors across tables.

26
CC5051NI Databases

5. Implementation

5.1 Creation of user

Figure 3: Screenshot of creating user, granting connect and resource and connecting to the user.

In the first part of implementation, it is required to create a different user for our
assignment to ensure that there is not any other tables in the specific user. It is created
by using create user command. It is also required to grant connect and resource, which
allows users to login and connect to Oracle database and provides other resources and
privileges. And all database table and queries for our assignment are done and stored in
this user account only. At last we need to connect to that user by simply typing it with
username and password.

27
CC5051NI Databases

5.2 Creating and Desribing the tables

5.2.1 Creating Customer table.

Figure 4: Screenshot of Creating Customer table.

The Customer table was successully created with 7 different attributes with Customer_ID
as primary key and other attributes with Not Null constraints. The table is created with all
attributes having suitable data types like Number and Varchar2. The customer table was
firstly created because it didn’t have any respective foreign key. The Customer table
stores all the information of customer.

28
CC5051NI Databases

5.2.2 Describing Customer table.

Figure 5: Screenshot of Describing Customer table.

The customer table is described in above table in SQL plus to retrieve the full information
of a customer table including datatype, column name and to check If the attribute is null
or not. In our table all the values are not null and Customer_ID is automatically assigned
as not null because it is primary key.

29
CC5051NI Databases

5.2.3 Creating Vendor table

Figure 6: Screenshot of Creating Vendor table.

The Vendor table was successully created with 5 different attributes with Vendor_ID as
primary key and other attributes with Not Null constraints. The table is created with all
attributes having suitable data types like Number and Varchar2. The Vendor table stores
all the information of Vendor.

30
CC5051NI Databases

5.2.4 Describing Vendor table

Figure 7: Screenshot of Describing Vendor table.

The vendor table is described in above table in SQL plus to retrieve the full information of
a vendor table including datatype, column name and to check If the attribute is null or not.
In our table all the values are not null and Vendor_ID is automatically assigned as not null
because it is primary key.

31
CC5051NI Databases

5.2.5 Creating Payment table.

Figure 8: Screenshot of Creating Payment table.

The Payment table was successully created with 2 different attributes with Payment_ID
as primary key and Payment_Option as Not Null constraints. The table is created with all
attributes having suitable data types lVarchar2. The Payment table stores all the
information of Payment done by Customers.

32
CC5051NI Databases

5.2.6 Describing Payment table.

Figure 9: Screenshot of Describing Payment table.

The payment table is described in above table in SQL plus to retrieve the full information
of a payment table including datatype, column name and to check If the attribute is null
or not. In our table all the values are not null and Payment_ID is automatically assigned
as not null because it is primary key.

33
CC5051NI Databases

5.2.7 Creating Product table.

Figure 10: Screenshot of Creating Product table.

The Product table was successully created with 7 different attributes with Product_ID as
primary key, Vendor_ID as foreign key and all other attributes as NOT NULL constraint.
Also the Product_Price attributes has Check constraint of greater than 0 because the
product price of the specific product cannot be less than 1 or 0. The table is created with
all attributes having suitable data types like Varchar2 and Number. The Product table
stores all the information of Products that are available in Gadget Emporium.

34
CC5051NI Databases

5.2.8 Describing Product table.

Figure 11: Screenshot of describing Product table.

The product table is described in above table in SQL plus to retrieve the full information
of a product table including datatype, column name and to check If the attribute is null or
not. In our table all the values are not null excluding Vendor_ID (foreign key) and
Product_ID is automatically assigned as not null because it is primary key.

35
CC5051NI Databases

5.2.9 Creating Orders table.

Figure 12: Screenshot of Creating Orders table.

The Orders table was successully created with 9 different attributes with Order_ID as
primary key, Customer_ID and Payment_ID as foreign key and all other attributes as NOT
NULL constraint. Also the Order_Quantity, Unit_Price, Total_Amount and Final_Amount
attributes has Check constraint of greater than 0 because the values in those attributes
cannot be less than 1 or 0. The table is created with all attributes having suitable data
types like Varchar2, Number and Date. The Orders table stores all the information of
Orders that are ordered by the customers.

36
CC5051NI Databases

5.2.10 Describing Orders table.

Figure 13: Screenshot of Describing Orders table.

The orders table is described in above table in SQL plus to retrieve the full information of
a orders table including datatype, column name and to check If the attribute is null or not.
In our table all the values are not null excluding Customer_ID and Payment_ID (foreign
key) and Order_ID is automatically assigned as not null because it is primary key.

37
CC5051NI Databases

5.2.11 Creating Order_Product table

Figure 14: Screenshot of Creating Order_Product table.

The Order_Product table was successully created with only 2 different attributes with
Order_ID and Product_ID as both Primary Key and Foreign Key. Actually, in this table
primary key is created by combination of both Order_ID and Product_ID which is known
as composite key. As Order_Product table is derived as Bridge table, it stores the
information of Product_ID of Order.

38
CC5051NI Databases

5.2.12 Describing Order_Product table

Figure 15: Screenshot of describing Order_Product table.

The Order_Product table is described in above table in SQL plus to retrieve the full
information of a table including datatype, column name and to check If the attribute is null
or not and both of the attributes are both primary key and foreign key as it is bridge table.
So, they are assigned as not null automatically. Both attributes have data type of Number.

39
CC5051NI Databases

5.3 Data Insertion and Display Inserted Data.

5.3.1 Inserting values in Customer table.

Figure 16: Screenshot of inserting values in Customer table.

All the relevant customer data are inserted in Customer table on the basis of their data
type. Insert all command is used to insert multiple values in same query. Also Select *
From Dual command is used to provide consistent way to structure INSERT ALL
command.

40
CC5051NI Databases

5.3.2 Displaying all data of Customer table.

Figure 17: Screenshot of displaying all data of Customer table using SELECT * command.

All the values that were inserted in Customer table is displayed using Select * command.
This command displays all the values of attributes that are selected using select
command. So, all the information of customer are displayed here.

41
CC5051NI Databases

5.3.3 Inserting values in Vendor table.

Figure 18: Screenshot of inserting values in Vendor table.

All the relevant vendor details are inserted in Vendor table on the basis of their data type.
Insert all command is used to insert multiple values in same query. Also Select * From
Dual command is used to provide consistent way to structure INSERT ALL command.

42
CC5051NI Databases

5.3.4 Displaying all data of Vendor table.

Figure 19: Screenshot of displaying all data of Vendor table using SELECT * command.

All the values that were inserted in Vendor table is displayed using Select * command.
This command displays all the values of attributes that are selected using select
command. So, all the information of vendor are displayed here.

43
CC5051NI Databases

5.3.5 Inserting values in Payment table.

Figure 20: Screenshot of inserting values in Payment table.

All the relevant payment details are inserted in Payment table on the basis of their data
type. Insert all command is used to insert multiple values in same query. Also Select *
From Dual command is used to provide consistent way to structure INSERT ALL
command.

44
CC5051NI Databases

5.3.6 Displaying all data of Payment table.

Figure 21: Screenshot of displaying all data of Payment table with SELECT * command.

All the values that were inserted in Payment table is displayed using Select * command.
This command displays all the values of attributes that are selected using select
command. So, all the information of payment are displayed here.

45
CC5051NI Databases

5.3.7 Inserting values in Product table.

Figure 22: Screenshot of inserting values in Product table.

All the relevant product details are inserted in Product table on the basis of their data
type. Insert all command is used to insert multiple values in same query. Also Select *
From Dual command is used to provide consistent way to structure INSERT ALL
command.

46
CC5051NI Databases

5.3.8 Displaying all data of Product table.

Figure 23: Screenshot of displaying all data of Product table with SELECT * command.

All the values that were inserted in Product table is displayed using Select * command.
This command displays all the values of attributes that are selected using select
command. So, all the information of product are displayed here.

47
CC5051NI Databases

5.3.9 Inserting values in Orders table.

Figure 24: Screenshot of inserting values in Orders table.

All the relevant order details are inserted in Orders table on the basis of their data type.
Insert all command is used to insert multiple values in same query. Also Select * From
Dual command is used to provide consistent way to structure INSERT ALL command.

48
CC5051NI Databases

5.3.10 Displaying all data of Orders table.

Figure 25: Screenshot of displaying all data of Orders table with SELECT * command.

All the values that were inserted in Orders table is displayed using Select * command.
This command displays all the values of attributes that are selected using select
command. So, all the information of orders are displayed here.

49
CC5051NI Databases

5.3.11 Inserting values in Order_Product table.

Figure 26: Screenshot of inserting values in Order_Product table.

All the relevant order details are inserted in Order_Product table on the basis of their data
type. Insert all command is used to insert multiple values in same query. Also Select *
From Dual command is used to provide consistent way to structure INSERT ALL
command.

50
CC5051NI Databases

5.3.12 Displaying all data of Order_Product table.

Figure 27: Screenshot of displaying all data of Order_Product table.

All the values that were inserted in Order_Product table is displayed using Select *
command. This command displays all the values of attributes that are selected using
select command. So, all the information of Order_Product are displayed here.

51
CC5051NI Databases

6. Database Querying

6.1 Information Query

a) List all the customers that are also staff of the company.

Figure 28: Query to list all customers that are staff of the company.

The query retrieves and displays customers who hold the designation of "Staff" within the
company. It provides a detailed list of these staff customers, including their ID, name,
address, phone number, email, customer category, and associated discount rates. This
information aids in identifying and managing staff members among the customer base.

52
CC5051NI Databases

b) List all the orders made for any particular product between the dates 01-05-
2023 till 28- 05-2023.

Figure 29: Query to list all the orders between the mentioned date.

The query retrieves and displays orders placed for any specific product within the
specified date range of May 1, 2023, to May 28, 2023. It provides details such as order
ID, order quantity, unit price, total amount, discount amount, final amount, order date,
customer ID, and payment ID. This information is useful for tracking and analyzing orders
for a particular product during the specified period, aiding in inventory management and
sales analysis.

53
CC5051NI Databases

c) List all the customers with their order details and also the customers who have
not ordered any products yet.

Figure 30: Query to list all customers with order details and also the customers who have not ordered yet.

This query combines customer details with order information, listing customers who have
placed orders along with their respective order details. It utilizes a LEFT JOIN between
the “CUSTOMER” and “ORDERS” tables, allowing the inclusion of customers who have
not placed any orders, with their details presented and order-related columns with blank
output. For instance, customers like Rijan Paudel, Jenish Katuwal, Chris Evans, and Miraj
Bhandari have not made any orders, so their order details is blank. The result provides a
comprehensive overview of all customers and their order history, including those without
any recorded orders.

54
CC5051NI Databases

d) List all product details that have the second letter ‘a’ in their product name and
have a stock quantity more than 50.

Figure 31: Query to list all the products with second letter 'a' in product name and have stock quantity more than 50.

The query retrieves product details for items with the second letter “a” in their names and
a stock quantity exceeding 50. The results include products such as the Samsung S23
Ultra, Galaxy Electric Toothpaste, Galaxy Smart Watch, Laxmi Joystick, Samsung PS4,
and Macbook Air M1. These products, identified by their names and stock quantities,
meet the specified criteria, providing a brief overview of relevant items in the inventory.

55
CC5051NI Databases

e) Find out the customer who has ordered recently.

Figure 32: Query to list the customer who has ordered recently.

This query retrieves the customer who has made the most recent order, displaying
essential details such as customer ID, name, order ID, quantity, final amount, and order
date. It achieves this by joining the `Customer` and `Orders` tables based on the customer
ID, then filtering for the order with the latest order date using a subquery with “MAX
(Order_Date)”. The result provides concise information about the most recent customer
order.

56
CC5051NI Databases

6.2 Transaction Query

a) Show the total revenue of the company for each month.

Figure 33: Query to show total revenue of company for each month.

The query calculates the total revenue of the company for each month by extracting the
month and year from the “Order_Date” column and grouping the results accordingly. It
uses the “TO_CHAR” function to format the date as “MM-YYYY”. The total revenue for
each month is obtained by summing the “Final_Amount” column. The results are then
ordered chronologically. For example, in January 2023, the total revenue is 97,200, and
the pattern continues for subsequent months. This query provides a clear overview of
the company's monthly revenue trends.

57
CC5051NI Databases

b) Find those orders that are equal or higher than the average order total value.

Figure 34: Query to find those orders that are equal or higher than average order total value.

The query retrieves orders with a final amount equal to or higher than the average order
total value. It achieves this by comparing the 'Final_Amount' of each order with the
subquery that calculates the average final amount using the “AVG” function. The result
includes orders with Order ID 353, 357, 359, 362, and 363, which meet the criteria of
being equal to or exceeding the average order total value. This query is useful for
identifying orders with above average financial significance.

58
CC5051NI Databases

c) List the details of vendors who have supplied more than 3 products to the
company.

Figure 35: Query to list details of vendors who have supplied more than 3 products.

The query retrieves details of vendors who have supplied more than 3 products to the
company. It accomplishes this by joining the 'Vendor' and 'Product' tables based on the
common “Vendor_ID” and then using the “COUNT” function to calculate the number of
products supplied by each vendor. The “HAVING” clause filters the results to include only
those vendors with a product count greater than 3. The output includes information such
as Vendor ID, Vendor Name, Vendor Phone Number, Vendor Email, Vendor Address,
and the count of products supplied. In the provided results, vendors like Evo Store and
Gautam Electronics meet the criteria by supplying 5 and 4 products, respectively.

59
CC5051NI Databases

d) Show the top 3 product details that have been ordered the most.

Figure 36: Query to show top 3 product details that were ordered the most.

The query retrieves the top 3 products with the highest order count. It calculates the total
number of orders for each product by joining the "Product" and "Order_Product" tables,
grouping the results by various product attributes, and sorting them in descending order
based on the order count. The final output includes details such as product ID, name,
description, category, price, stock quantity, vendor ID, and the calculated total order
count. This query is valuable for identifying the most popular products in terms of order
frequency.

60
CC5051NI Databases

e) Find out the customer who has ordered the most in August with his/her total
spending on that month.

Figure 37: Query to find customer who has most ordered the most in August with his/her total spending of that month.

The query retrieves the customer who has made the most orders in August along with
their total spending for that month. It achieves this by joining the "Customer" and "Orders"
tables, filtering the results for orders placed in August 2023, grouping them by customer
ID and name, calculating the sum of the final amounts for each customer, and ordering
the results in descending order based on total spending. The outer query then selects the
top row using the ROWNUM constraint, limiting the output to the customer with the
highest spending in August. In this specific example, the result shows that customer with
ID 111, named Sher Deuba, has the highest total spending of 270,900 in August 2023.

61
CC5051NI Databases

7. Critical Evaluation

7.1 Critical Evaluation of module, its usage and relation with other subject

Database is one of the most important and helpful subject or technical knowledge that
one can gain for being top in IT and other business related careers. It helps to choose
very diverse career options in IT and other career. And having very good foundational
base is very important in database. Our module tutors have played very significant role
for developing these foundational base of database by providing practical knowledge of
database management and SQL. While the module has been instrumental in building a
solid foundation in database management and SQL, there's room for improvement. The
practical aspect of working with databases is a key component in real-world scenarios.
Therefore, incorporating hands-on experience with database workbenches, rather than
just command-line operations, could enhance the learning experience. This practical
approach aligns more closely with industry practices, preparing effective transitions into
professional roles where databases are managed through dedicated workbenches.

The acquired knowledge in the database module holds immense practical


significance in various professional domains, particularly in Information Technology (IT)
and related business careers. The understanding of databases opens up diverse career
options, as databases are fundamental to the management and retrieval of data in almost
every sector. Proficiency in database management and SQL, gained through our module,
provides a strong foundational base for a successful career.

The knowledge gained in the database module is closely interlinked with other
subjects, forming a integrated understanding of IT systems. For instance, databases play
a crucial role in the development and functionality of software applications, making the
knowledge gained in this module applicable to software engineering and development
subjects. Additionally, the management and utilization of data are integral to broader
subjects like data science and analytics, where database skills become highly relevant.

62
CC5051NI Databases

7.2 Critical Assessment of coursework

The coursework structure effectively guides us through the details of database design
and implementation. The introduction of a detailed case study for "Gadget Emporium"
provides a realistic context, shaping the database design with clear business rules. The
breakdown of tasks, from the initial ERD to normalization. However, there is an
opportunity to increase practical involvement, especially during the implementation
phase. This would improve the application of theoretical concepts and provide a more
hands-on learning experience.

The case study is robust, offering a subtle understanding of business requirements. The
SQL queries align smoothly with the specified business rules, providing both information
and transactional queries. Exploring deeper into challenges encountered during the
design and implementation phases would enhance the evaluation section, providing
valuable insights into decision-making processes.

Overall, the coursework delivers a comprehensive understanding of database


design and implementation, with an opportunity for refinement through increased hands-
on engagement in practical exercises.

63
CC5051NI Databases

8. Database Dump File Creation

Figure 38: Screenshot of Creating Dump file in cmd.

Creating a dump file of your database in SQL Plus is essential for coursework
submissions. These files serve as backups, providing a snapshot of your database for
potential restoration. In the context of coursework, dump files simplify data sharing with
tutors, ensuring they can easily assess your work while maintaining data accuracy and
consistency. Tutors can use these files to review your database at a specific point in time,
enhancing the overall integrity of your coursework submissions.

64
CC5051NI Databases

9. Spool File Creation

Creating a spool file in SQL Plus is vital for coursework submissions and general
database situations. In coursework, it is crucial as the spool file captures SQL Plus output,
documenting queries and results, providing a detailed record for assessment and
potential troubleshooting. In general situations, spool files serve as essential logs,
tracking commands, errors, and results in SQL Plus sessions. They offer valuable
references for analysis, debugging, and auditing, contributing to effective database
management practices.

9.1 Spool File Creation of Information Query 1.

Figure 39: Screenshot of creating spool file of information query number 1.

65
CC5051NI Databases

9.2 Spool File Creation of Information Query 2.

Figure 40: Screenshot of creating spool file of information query number 2.

66
CC5051NI Databases

9.3 Spool File Creation of Information Query 3.

Figure 41: Screenshot of creating spool file of information query number 3.

67
CC5051NI Databases

9.4 Spool File Creation of Information Query 4.

Figure 42: Screenshot of creating spool file of information query number 4.

68
CC5051NI Databases

9.5 Spool File Creation of Information Query 5.

Figure 43: Screenshot of creating spool file of information query number 5.

69
CC5051NI Databases

9.6 Spool File Creation of Transaction Query 1.

Figure 44: Screenshot of creating spool file of transaction query number 1.

70
CC5051NI Databases

9.7 Spool File Creation of Transaction Query 2.

Figure 45: Screenshot of creating spool file of transaction query number 2.

71
CC5051NI Databases

9.8 Spool File Creation of Transaction Query 3.

Figure 46: Screenshot of creating spool file of transaction query number 3.

72
CC5051NI Databases

9.9 Spool File Creation of Transaction Query 4.

Figure 47: Screenshot of creating spool file of transaction query number 4.

73
CC5051NI Databases

9.10 Spool File Creation of Transaction Query 5.

Figure 48: Screenshot of creating spool file of transaction query number 5.

74
CC5051NI Databases

10. Drop Query

10.1 Dropping Order_Product Table.

Figure 49: Screenshot of Dropping Order_Product Table.

10.2 Dropping Product Table.

Figure 50: Screenshot of Dropping Product table.

75
CC5051NI Databases

10.3 Dropping Vendor Table.

Figure 51: Screenshot of Dropping Vendor Table.

10.4 Dropping Orders Table.

Figure 52: Screenshot of Dropping Orders Table.

76
CC5051NI Databases

10.5 Dropping Payment Table.

Figure 53: Screenshot of Dropping Payment Table.

10.6 Dropping Customer Table.

Figure 54: Screenshot of Dropping Customer Table.

10.7 Showing that all Tables are dropped.

Figure 55: Screenshot of showing that all tables have been dropped successfully.

77
CC5051NI Databases

11. Conclusion

In conclusion, the coursework effectively guided the exploration of database design and
implementation, terminating in a robust database system for "Gadget Emporium." The
initial ERD served as the foundation for the subsequent normalization process, which
ensured data integrity and adherence to database principles. The implementation phase
brought the conceptual design to life, creating tables, inserting relevant data, and
establishing relationships among entities.

The information and transaction queries demonstrated the versatility of the


database in extracting meaningful insights and facilitating various business operations.
The database dump and spool files provided comprehensive documentation of the
database structure and query results, aiding in coursework submission and future
reference.

Despite the strengths of the coursework, there remains room for improvement.
Enhancing the practical component by incorporating hands-on exercises with database
workbenches would align the learning experience more closely with industry practices.
Additionally, delving into the challenges faced during the design and implementation
phases would enrich the evaluation section, showcasing the decision-making process
and providing valuable lessons for future database activities.

Overall, the coursework provided a comprehensive understanding of database


design, normalization, implementation, and query execution, laying a solid foundation for
further exploration and application of database concepts in real-world scenarios.

78
CC5051NI Databases

12. References

Geeksforgeeks, 2023. Types of Attributes in ER Model - GeeksforGeeks. [Online]


Available at: https://www.geeksforgeeks.org/types-of-attributes-in-er-model/
[Accessed 15 01 2024].
Microsoft, 2023. Database normalization description - Microsoft 365 Apps | Microsoft
Learn. [Online]
Available at: https://learn.microsoft.com/en-us/office/troubleshoot/access/database-
normalization-description
[Accessed 15 01 2024].
Point, J. T., 2023. Entity in DBMS - javatpoint. [Online]
Available at: https://www.javatpoint.com/entity-in-dbms
[Accessed 15 01 2024].

79

You might also like