Tải bản đầy đủ (.pdf) (43 trang)

Assignment 1 1622 Database Design Development Distinction

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.33 MB, 43 trang )

ASSIGNMENT 1 FRONT SHEET
Qualification

TEC Level 5 HND Diploma in Computing

Unit number and title

Unit 04: Database Design & Development

Submission date

25/02/2023

Re-submission Date

Date Received 1st submission

25/02/2023

Date Received 2nd submission

Student Name

Tran Duc Long

Student ID

GCH210562

Class


GCH1106

Assessor name

Dinh Duc Manh

Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.

Student’s signature
Grading grid

P1

M1

D1

Page 1 of 42


 Summative Feedback:

 Resubmission Feedback:

2.1

Grade:
Signature & Date:


2.2

Assessor Signature:

Date:

Page 2 of 42


Table of Contents
A. Introduction ........................................................................................................................................................................... 6
B.

C.

Task 1. Statements of user and system requirements .............................................................................................................. 7
1.1.

Overview about the Problem ....................................................................................................................................................... 7

1.2.

Requirements of the application ................................................................................................................................................. 7

a.

Business process........................................................................................................................................................................... 7

b.


Business rules ............................................................................................................................................................................... 7

c.

Requirements ............................................................................................................................................................................... 8

d.

User story ..................................................................................................................................................................................... 9

e.

Objectives (Things intended to achieve) ...................................................................................................................................... 9

f.

Output .......................................................................................................................................................................................... 9

Task 2. Design the relational database system ...................................................................................................................... 12
2.1 Analyse the requirements ............................................................................................................................................................... 12
2.2 Database design with explanations ................................................................................................................................................ 13
a. Logical design(ERD) ........................................................................................................................................................................ 13
b. ER diagram ..................................................................................................................................................................................... 17
2.3 Review whether the database is normalized .................................................................................................................................. 19
a.

First Normal Form (1NF)............................................................................................................................................................. 20

b.


Second Normal Form (2NF) ........................................................................................................................................................ 20

c.

Third Normal Form (3NF) ........................................................................................................................................................... 21

d.

Conclusion .................................................................................................................................................................................. 22
Page 3 of 42


2.4 Data validation ................................................................................................................................................................................ 24
2.5 Wireframe of the application .......................................................................................................................................................... 30
2.6 Evaluation ........................................................................................................................................................................................ 40
a.

Advantage .................................................................................................................................................................................. 40

b.

Disadvantage .............................................................................................................................................................................. 41

c.

Future development plans ......................................................................................................................................................... 41

D. Conclusion ............................................................................................................................................................................ 42
E.


References ........................................................................................................................................................................... 42

Page 4 of 42


Table of picture
Picture 1: Information of Customer ............................................................................................................................................................................. 10
Picture 2: Information of Staff ..................................................................................................................................................................................... 10
Picture 3: Information of Products .............................................................................................................................................................................. 10
Picture 4: Information of Orders.................................................................................................................................................................................. 11
Picture 5: Top 5 Customers spend the most in the year ............................................................................................................................................. 11
Picture 6: Top 5 Products purchased the most in the year ......................................................................................................................................... 11
Picture 7: Top 5 staffs sell the most in the year .......................................................................................................................................................... 12
Picture 8: Entity-relationship diagram at the conceptual level ................................................................................................................................... 17
Picture 9: Complete Entity Relationship Diagram........................................................................................................................................................ 18
Picture 10: Login interface ........................................................................................................................................................................................... 31
Picture 11: Main layout ................................................................................................................................................................................................ 32
Picture 12: Menu of View option ................................................................................................................................................................................. 33
Picture 13: Example of View Customer List Layout ..................................................................................................................................................... 34
Picture 14: Menu of add options ................................................................................................................................................................................. 35
Picture 15: Example of Add new Staff Layout.............................................................................................................................................................. 36
Picture 16: Menu of Update options ........................................................................................................................................................................... 37
Picture 17: Update Customer layout ........................................................................................................................................................................... 38
Picture 18: Menu of Statistic options .......................................................................................................................................................................... 39

Page 5 of 42


A. Introduction

We live in a modern society where everything is modern and innovative. Every day, there is a lot of innovation,
especially in technology. When it comes to technology, we must admit that it has permeated every aspect of our lives,
from simple devices such as phones and computers to complex programming applications. Currently, digital
transformation technology is gaining popular in a variety of disciplines, particularly company management models.
While offline stores are progressively becoming outdated, online shops are an excellent solution for developing this
model.
In this assignment, I will discuss relational database, specifically how I design it, detailed explanations of its functions
and characteristics, and finally an evaluation of the functions and the design. In addition, I created 8 tables in my
design to easily manager, and each table has its own function and information to create a manage system for FPT
SHOP. These tables will help managers enter client information or staffs, products such as address or id, and the
program will also help managers determine which consumers purchase the most, which things sell best, and which
employees are the best.

Page 6 of 42


B. Task 1. Statements of user and system requirements
1.1.

Overview about the Problem
FPT Shop is now experiencing difficulty in processing the database from all of its locations around the country,
which is increasing as the number of stores grows which is expanding due to the growth in the number of stores.
FPT shop approached my firm and requested assistance. I decided to create a new database where people may
register using their phone number or email address as their ID and place an order. Each consumer will be assigned
a caregiver, and each staff will report to their management. This will assist FPT Shop in managing all data ranging
from staff to customers, as well as new or additional items to the organization. As a result, in order to create a
new database, I need to understand the needs of consumers, users, and staff while signing into the application
and ordering and reviewing items. Customer information will also be kept safe and secure, staffs and manager,
who will oversee everything to ensure that the application always fulfills the user's requirements.


1.2.

Requirements of the application
a. Business process




Clients and employees can access the application by inputting login information in the login screen. After
logging in, customers and employees may enter their information to implement options.
Customers who wish to swap products and information must submit a request to management in order for
the exchange customer and their information to be accepted.
Once a consumer puts an order, the staff will review the order, its progress, and the client's order notes.
Managers and directors may also access all data on customers, staffs, or goods, as well as statistics on
which customers purchase the most, which items sell the best, and which employees are the best.

b. Business rules




Customer, staffs, managements, accountants and directors must use a phone number or email account to
log in to the application. Customers are unable to change their own information or orders.
Staff can view order advice for customers
The manager can edit the information of the order as well as the customer. If customers want to change.
They will have logged in and place an order will receive an email with a request to amend the information.
Page 7 of 42






If the request is approved by the management, the client may modify the information or erase it and
reinstall a new one. (Management has only 24 hours to approve or decline the request).
The accountant can view the store's sales statistics so that they can be submitted to the management.
The board of directors will look at the statistics of the accounting reports, then apply the reward policy for
employees as well as apply discount codes to customers.

c. Requirements
➢ The database that is developed must fulfill fundamental criteria such as ease of access, storage,
management, and updating. The system must also assure the database's security. At the same time, they
must satisfy all of the scenario's criteria.
➢ Functional requirements:
• Customer:
o Customers may order products.
o After logging in, the customer may examine product information and provide it.
o Once the manager accepts that need, the customer can add information to the order product
and delete that information.
• Staff:
o Employees login app and can access just product and order of client.
o Employees can change order status.
o Employees can view customer information.
• Manager:
o Administrators can accept requests to alter client information.
o A manager can manage many staffs and can keep information.
o Managers have the ability to regulate product, add product, and delete product.
o Managers can also edit or delete information of employees as well as customers.
• Product:
o When a valuable product is brought to the store, it must have a distinct brand.


Page 8 of 42


o Products will be classified into certain categories, with pricing that are competitive in both the
domestic and international markets.
➢ Non-functional requirements:
All objects will be able to log in using their FPT username and password in 20 minutes.
The web can be accessed by up to 500 users at once.
It takes less than 3 seconds for the web to respond.

d. User story







As a Customer, I want to buy quality products on the app and have it delivered to my door to save
time. So that I don't have to wait in line and wait at the store. Everything on the app is very clear like
name, price, quality.
As a Staff, I want to see product information, customer information, orders. So I logged in to the app to
get information for consulting and care customer
As a Manager of FPT shop, I want to edit the information’s products. So that I logged into the system to
check. Everything on the app is very clear like product's name, brands, categories, total price.
As an accountant, I want to see product information, the number of products in stock. So that I can
control revenue of shop.
As an accountant, I want to see the store's sales statistics. So that I logged into the system to check
from which to apply the reward policy for employees.


e. Objectives (Things intended to achieve)
The database must provide adequate functions, such as viewing, adding, removing, and updating data, as well
as allowing users to quickly and easily access it, and it must also be safe.

f. Output
The output to the system will be the data of information of products, staffs, and customers, etc.

Page 9 of 42


Picture 1: Information of Customer

Picture 2: Information of Staff

Picture 3: Information of Products

Page 10 of 42


Picture 4: Information of Orders

Picture 5: Top 5 Customers spend the most in the year

Picture 6: Top 5 Products purchased the most in the year

Page 11 of 42


Picture 7: Top 5 staffs sell the most in the year


C. Task 2. Design the relational database system
2.1 Analyse the requirements




Management, staff, retailers, and customers all utilize the app for different reasons, but the unifying goal is to deliver
things to customers. This system protects client or order information to avoid theft and invasion of privacy, so
customers may feel secure when shopping on the system. If the client wishes to change the information or order, the
manager's approval is necessary. Managers can also see customer and order data. The consumer can place several
things in an order and the staff will always update the order status for the buyer to trust.
I utilize the Microsoft SQL Server database to plan a database based on the company's requirements. There are 8
tables in my database, separated parts into sales and productions, each containing different functions to suit the
requirements of the FPT shop. Tables include:
o About sales:
✓ Customers: Holds complete client information such as ID, name, address, phone number, and so on.
✓ Staffs: provides complete employee information such as ID, name, and address, manager...
✓ Orders: including order date, shipped date, order status
✓ OrderItems: includes information such as the number of goods and the customer's total purchase amount.
Page 12 of 42


✓ Discounts: includes time-limited discount codes.
o About productions:
✓ Products: displays all info associated with the product.
✓ Categories table: used to display all product categories to assist FPT Shop in controlling and following
consumers.
✓ Brands: contains brands associated with each FPT store goods.

2.2 Database design with explanations

a. Logical design(ERD)
Identify relationships:

Identify and associate attributes with entities

Page 13 of 42


No
1
2
3
4
5
6
7
8

Staffs entity
Attribute
Decription
StaffId
Contains staff’s Id
FirstName
Contains staff’s FirstName
LastName
Contains staff’s LastName
MidName
Contains staff’s MidName
Status

Contains staff’s status
PhoneNumber
Contains staff’s number phone
Email
Contains Staff’s email
ManageId
Contains Staff’s Id manager
Primary key: StaffId, Foreign key: ManageId

Orders entity
No
1
2
3
4
5
6
7
8

Attribute
Decription
OrderId
Contains order’s Id
CreateDate
Contains order’s created date
RequireDate
Contains order’s required date
ShippedDate
Contains order’s shipped date

OrderStatus
Contains order’s status
CustomerId
Contains customer’s Id
StaffId
Contains staff’s Id
OrderItemId
Contains orderItem’s Id
Primary key: OrderId, Foreign key: CustomerId, StaffId, OrderItemId

Page 14 of 42


No
1
2
3
4
5
6

OrderItems entity
Attribute
Decription
OrderItemId
Contains item’s Id
Quantity
Contains quantity items
TotalPrice
Contains total money order

OrderId
Contains order’s Id
ProductId
Contains product’s Id
DiscountId
Contains discount’s Id
Primary key: OrderItemId, Foreign key: OrderId, ProductId, DiscountId

Discounts entity
No
1
2
3
4
5
6
7

Attribute
DiscountId
DiscountName
StartAt
EndAt
DiscountType
DiscountPercent
DiscountAmount

Decription
Contains discount’s Id
Contains name’s discount

Contains start at date
Contains end at date
Contains code type
Contains percent discount
Contains reduction amount
Primary key: DiscountId

Page 15 of 42


No
1
2
3
4
5

Products entity
Attribute
Decription
ProductId
Contains product’s Id
Name
Contains product’s name
Price
Contains product’s price
BrandId
Contains brand’s Id
CategoyId
Contains category’s Id

Primary key: ProductId, Foreign key: BrandId, CategoryId

Brands entity
No
1
2

Attribute
BrandId
Name

Decription
Contains brand’s Id
Contains brand’s name
Primary key: BrandId

Categories entity
No
1
2

Attribute
CategoryId
Name

Decription
Contains brand’s Id
Contains category’s name
Primary key: CategoryId


Page 16 of 42


b. ER diagram

Picture 8: Entity-relationship diagram at the conceptual level

Page 17 of 42


Picture 9: Complete Entity Relationship Diagram
Page 18 of 42






Description of the ER diagram: The diagram above has 8 entities that are related to one another, with the OrderItems
entity being distinct from the link between the two segments sales and productions. The above entities all have the
attributes listed above.
There are 8 relationships between 8 entities:
o Customer and Orders (1 - m): 1 customer can place multiple orders but those orders can only be ordered by 1
customer.
o Staff and Orders :(1 - m) 1 staff can create multiple orders but those orders can only be created by 1 staff.
o Staffs and Staffs (1-m): 1 manager can manage many employees but the employees can only be managed by 1
manager.
o Orders and OrderItems (1 - m): An orders can belong to more than 1 items of order items if the orders
contains more than 1 products, but each items in the order items is only related to one order.
o Discount and OrderItems(1-m): 1 discount code can be applied to multiple items but 1 item can only contain 1

discount code.
o Product and OrderItems(1-m): 1 product can have multiple items but those items can only be selected by 1
product.
o Brands and Products(1-m): 1 brand can have multiple products but those products can only be contained by 1
brand.
o Categories and Products(1-m): 1 category can have multiple products but those products can only be had by 1
category.

2.3 Review whether the database is normalized




Database normalization is a method for structuring data in a database. Normalization is a method of dissecting
tables in a systematic way to minimize data redundancy (repetition) and undesired features such as Insertion,
Updating, and Deletion Anomalies. It is a multi-step method that converts data into tabular format while deleting
duplicates from relation tables. (Anon, n, d)
Normalization is mostly used to eliminate duplicate (useless) data.
Page 19 of 42





Assuring that data dependencies make sense, i.e. that data is stored properly.
Common types of data normalization:
a. First Normal Form (1NF)
o To be in the First Normal Form, a table must meet the four conditions outlined below:
▪ It should only contain attributes/columns with single (atomic) values.
▪ Column values should be from the same domain.

▪ A table's columns should all have distinct names.
▪ And the sequence in which data is stored is irrelevant.
o Example:
✓ The Staff table is not in 1st normal form because it contains the multivalued attribute PhoneNumber
column:
StaffId
1

Name
Trần Đức Long

Status
Working

Email


2
3

Nguyễn Tiến Đạt
Nguyễn Vân Ly

Working
Working




PhoneNumber

0327268237,
0945848855
0912552226
0976123123,
0902123123

✓ To return the above table to 1NF, we separate each value into a row as follows:
StaffId
1

Name
Trần Đức Long

Status
Working

Email


PhoneNumber
0327268237

1
2
3
3

Trần Đức Long
Nguyễn Tiến Đạt
Nguyễn Vân Ly

Nguyễn Vân Ly

Working
Working
Working
Working






0945848855
0912552226
0976123123
0902123123

b. Second Normal Form (2NF)
o In order for a table to be in Second Normal Form,
▪ It must be written in the 1NF.
Page 20 of 42



×