1622 Asm1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

ASSIGNMENT 1 FRONT SHEET

Qualification TEC Level 5 HND Diploma in Computing

Unit number and title Unit 04: Database Design & Development

Submission date Date Received 1st submission

Re-submission Date Date Received 2nd submission

Student Name Dao Van Hieu Student ID GCH211135

Class GCH1105 Assessor name Tran Thi Thoa

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 Hieu

Grading grid

P1 M1 D1
❒ Summative Feedback: ❒ Resubmission Feedback:

Grade: Assessor Signature: Date:


Signature & Date:
Contents
Chapter 1 State of user and system requirements (P1) ............................................................................................................................................ 5
1.1 Overview about the problem ............................................................................................................................................................................. 5
1.2 Requirements of the application ....................................................................................................................................................................... 5
Chapter 2 Design the relational database system (M1) ............................................................................................................................................ 6
2.1 Database design with explanations ................................................................................................................................................................... 6
2.2 Normalization of the database .......................................................................................................................................................................... 8
2.3 Data validation ................................................................................................................................................................................................. 10
2.4 Input/ Output ................................................................................................................................................................................................... 11
2.5 Wireframe .......................................................................................................................................................................................................... 14

Figure 1: Database Diagram ........................................................................................................................................................................................... 6


Figure 2: Normalized diagram ........................................................................................................................................................................................ 9
Figure 3: Data validation .............................................................................................................................................................................................. 10
Figure 4: Director ......................................................................................................................................................................................................... 11
Figure 5: Manager ........................................................................................................................................................................................................ 11
Figure 6: OrderItem ..................................................................................................................................................................................................... 11
Figure 7: Oder .............................................................................................................................................................................................................. 12
Figure 8: Product .......................................................................................................................................................................................................... 12
Figure 9: Client ............................................................................................................................................................................................................. 13
Figure 10: Feedback ..................................................................................................................................................................................................... 13
Figure 11: Wireframe Login ......................................................................................................................................................................................... 14
Figure 12: Wireframe Employee Information in the Director's Interface ................................................................................................................... 15
Figure 13: Wireframe Add Employee in the Director's Interface ................................................................................................................................ 16
Figure 14: Wireframe List Product in the Manager's Interface ................................................................................................................................... 17
Figure 15: Wireframe Customer Information in the Manager's Interface .................................................................................................................. 18
Figure 16:Wireframe Add Product in the Manager's Interface ................................................................................................................................... 19
Figure 17: Wireframe Client's Interface ....................................................................................................................................................................... 20
Figure 18: Wireframe Cart In the Client's Interface ..................................................................................................................................................... 21
Figure 19: Wireframe Change Infomation In the Client's Interface............................................................................................................................. 22
Figure 20:Wireframe Feedback In the Client's Interface ............................................................................................................................................. 23
Chapter 1 State of user and system requirements (P1)

1.1 Overview about the problem

A company called FPT Shop, which is expanding and facing difficulties in managing the database from all its stores across the
country. To address this issue, FPT Shop has decided to develop a new database system that can allow users to register with their
phone numbers as IDs, order or rate products, and leave comments about their purchases. The system should also enable shop
managers to take care of their stores and enable the director board to view all data from all shops.

As an IT professional, your tasks are to work with FPT Shop to identify the current requirements for each system, analyze the
requirements, and produce clear statements of user and system requirements. Based on the analysis, you will design a relational
database system using appropriate design tools and techniques. Then, you will develop a fully functional relational database system,
test it against user and system requirements, and produce technical and user documentation. The ultimate goal is to provide a reliable
and efficient database system that can help FPT Shop manage its stores and enhance the user experience for its customers.

1.2 Requirements of the application

The user can place an order or rate products: Customers can order products and rate them based on their satisfaction level.
The user can leave feedback about their purchase transaction: Customers can provide feedback about their purchase transaction by
leaving a review or rating.
The system should allow store managers to manage their store: The system should provide store managers with the ability to manage
their store, including product inventory, order processing, and customer information.
The system should allow the director to view all data from all stores: The system should allow the director to access and view data
from all stores, through the store managers.
The director requires a system capable of managing product information, customer orders, and detailed customer information: The
system should provide the director, through the manager, with a comprehensive view of the inventory of products, customer orders,
and detailed customer information. Additionally, the system should allow the director to view manager information, add other
managers, or also dismiss, remove incompetent managers.
The system must allow for adding, modifying, and deleting product information: Store managers can add, modify, and delete product
information, including name and availability status.
The system should provide the ability to display inventory status: The system should allow users to view the current number of
products available in stock.
The system should allow for tracking of sold products and related profits: The system should provide a dashboard for tracking the
number of products sold and related profits.
Overall, the system needs to provide a comprehensive solution to help FPT Shop manage its stores and improve the customer
experience. The database system must be capable of handling a large amount of data and easily scalable to accommodate future
growth. The system must also be reliable, secure, and efficient, providing fast and accurate data access for users at all levels.

Chapter 2 Design the relational database system (M1)

2.1 Database design with explanations


Database Diagram:

Figure 1: Database Diagram


Explanation:

- Director: This entity represents a director and has attributes like Director_ID, Name, and Description. A Director entity can
be associated with multiple Manager entities, but each Manager entity can be associated with only one Director entity. For
example, the director can manage the manager's information including product information and customer orders, even
customer information and their feedback. This represents a one-to-many relationship between the Director and Manager
entities.
- Manager: This entity represents the manager and has properties like Manager_ID, FirstName, LastName, Phone, Mail, and
Director_ID. A manager reports to a director, and a director can have multiple managers working under them. A Manager
entity can manage customer orders, customer information and their feedback. This also represents a one-to-many relationship
between the Manager and Order entities.
- Order: This entity represents an order and has properties like Order_ID, OrderDate, TotalAmount, and Manager_ID. An
order is created by a manager and a manager can create multiple orders. An order can contain multiple products. The Order
entity can contain multiple orderItem entities, but each orderItem entity can only be associated with one Order entity, in
addition an order can have multiple feedbacks, but each feedback can only comment one order . This represents a one-to-many
relationship between the Order and Product, order, and feedback entities.
- Product: This entity represents a product and has attributes like Product_ID, Name, Description, Price, In-stock Quantity, and
Order_ID. A product is part of an orderItem and an OrderItem can contain multiple products.
- Customer: This entity represents a customer and has properties like Client_ID, FirstName, LastName, Phone, Mail, and
Order_ID. One customer places an order and one order can be placed by one customer. A Customer entity can order multiple
Order entities, but each Order entity can only be associated with one Customer entity, and a client can have multiple feedbacks
but each feedback can only have 1 client . This represents a one-to-many relationship between the Customer and Order,
customer, and feedback entities.
- Feedback: This entity represents a feedback and has properties like Feedback_ID, comment,Order_ID, Clent_ID. A feedback
can only be replied by one customer and a customer can respond to many feedbacks. In addition, Order can manage the
feedback left by any customer. This represents a one-to-many relationship between Feedback and Client, Order and feedback
entities
2.2 Normalization of the database

My database was not in first normal form (1NF) because some tables contain duplicate fields and did not have a unique primary key to
identify unique records. Therefore, I have performed the task of data normalization to minimize data redundancy, avoid data loss or
duplication issues, and improve data input speed.
First normal form (1NF):
Director: Director_ID (primary key), Name,Phone, Mail, Description
Manager: Manager_ID (primary key), FirstName, LastName, Phone, Mail, Director_ID
Order: Order_ID (primary key), OrderDate,ShippedDate, TotalAmount, Manager_ID
Products: Product_ID (primary key), Name, Description, Price, QuantityInStock
Client: Client_ID (primary key), FirstName, LastName, Phone, Mail
In 1NF, I have separated the tables so that there are no duplicate fields, and each table has a unique primary key to identify unique
records.
Feedback: Feedback_IDprimary key), comment, Order_ID, Client_ID
Second normal form (2NF):
Director: Director_ID (primary key), Name, Description
Manager: Manager_ID (primary key), FirstName, LastName, Phone, Mail, Director_ID (foreign key)
Order: Order_ID (primary key), OrderDate, TotalAmount, Manager_ID (foreign key), Client_ID (foreign key)
Products: Product_ID (primary key), Name, Description, Price
OrderItem: Order_ID (foreign key), Product_ID (foreign key), Quantity
Client: Client_ID (primary key), FirstName, LastName, Phone, Mail
Feedback: Feedback_IDprimary key), comment, Order_ID, Client_ID
In 2NF, I have separated the Products table to create a separate table for product information, and split the Order table into two
separate tables to store information about orders and details of each order item. I have also split the foreign key Manager_ID in the
Order table into a separate table called Manager to store detailed information about each manager. Additionally, I have split the Client
and Order tables into a separate Order table to store information about each customer's orders.
Here is the normalized diagram:

Figure 2: Normalized diagram


2.3 Data validation
Table Name Fields Data Type Constrain
Director_ID INT Primary key, not null
Director Name VARCHAR(30)
Description TEXT
Manager_ID INT Primary key, not null
FirstName VARCHAR(10)
Manager LastName VARCHAR(10)
Phone VARCHAR(25)
Mail VARCHAR(255) Unique, not null
Director_ID INT Foreign key, null
Product_ID INT Primary key, not null
Name VARCHAR(255)
Product Description TEXT
Price DECIMAL(10,2) Not null
QuantityInStock INT Not null
Client_ID INT Primary key, not null
FirstName VARCHAR(10)
Client LastName VARCHAR(10)
Phone VARCHAR(25)
Mail VARCHAR(255) Unique, not null
Order_ID INT Primary key, not null
OrderDate DATE Not null
Order ShippedDate DATE Not null
Manager_ID INT Foreign key, null
Client_ID INT Foreign key, null
Feedback_ID INT Primary key, not null
Feedback Comment TEXT
Order_ID INT Foreign key, null
Client_ID INT Foreign key, null
Order_Item_ID INT Foreign key, null
Order_Item TotalAnount DECIMAL(10,2) Not null
Product_ID INT Foreign key, null
Figure 3: Data validation
2.4 Input/ Output

Director_ID Name Description


1 Christopher Nolan British-American filmmaker known for his intricate, non-linear storytelling
2 Spike Lee American film director, producer, writer, and actor
Figure 4: Director

Manager_ID FirstName LastName Phone Mail Director_ID


1 John Smith 555-1234 jsmith@email.com 1
2 Maria Garcia 555-5678 mgarcia@email.com 1
3 David Lee 555-9876 dlee@email.com 2
4 Emily Wong 555-4321 ewong@email.com 1
5 Javier Gonzalez 555-1111 jgonzalez@email.com 2
6 Hannah Kim 555-2222 hkim@email.com 2
Figure 5: Manager

Order_ID Product_ID Quantity TotalAmount


1 1 3 3299.97
2 2 2 2399.98
3 5 6 2099.94
4 4 4 7199.96
5 6 7 699.93
6 3 2 2799.98
7 8 1 299.99
8 7 1 799.99
9 5 2 699.98
10 4 3 5399.97
Figure 6: OrderItem

Order_ID OrderDate ShippedDate Manager_ID Client_ID


1 2023-04-10 2023-04-12 1 1
2 2023-04-11 2023-04-15 4 2
3 2023-04-12 2023-04-14 4 3
4 2023-04-13 2023-04-20 2 4
5 2023-04-14 2023-04-17 2 5
6 2023-04-15 2023-04-19 1 6
7 2023-04-16 2023-04-22 1 7
8 2023-04-17 2023-04-25 2 8
9 2023-04-18 2023-04-20 5 9
10 2023-04-19 2023-04-23 6 10
Figure 7: Oder

Product_ID Name Description Price Quantity


1 iPhone 13 Pro Latest high-end smartphone from Apple 1099.99 100
2 Samsung Galaxy S21 Flagship smartphone with 5G capabilities 1199.99 50
Ultra
3 Dell XPS 13 Thin and light ultrabook with powerful performance 1399.99 55
4 MacBook Pro Professional-grade laptop from Apple with M1 chip 1799.99 88
5 Sony WH-1000XM4 Wireless noise-cancelling headphones 349.99 99
6 Logitech MX Master 3 Wireless ergonomic mouse for productivity 99.99 223
7 iPad Pro Powerful tablet with M1 chip and optional Apple 799.99 87
Pencil
8 Bose QuietComfort 35 II Wireless noise-cancelling headphones 299.99 66
Figure 8: Product

Client_ID FirstName LastName Phone Mail


1 John Smith 123456789 john.smith@gmail.com
2 Jane Doe 987654321 jane.doe@yahoo.com
3 Bob Johnson 5551234567 bob.johnson@hotmail.com
4 Alice Brown 5559876543 alice.brown@gmail.com
5 David Lee 1231231234 david.lee@gmail.com
6 Sarah Nguyen 4564564567 sarah.nguyen@yahoo.com
7 Michael Kim 7897897890 michael.kim@hotmail.com
8 Emily Park 5555555555 emily.park@gmail.com
9 Daniel Chen 1234567890 daniel.chen@yahoo.com
10 Sophia Garcia 1112223333 sophia.garcia@hotmail.com
Figure 9: Client

Feedback_ID Comment Client_ID Order_ID


1 Good service 1 1
2 Could be better 5 5
3 Excellent job 3 3
4 Slow delivery 2 2
5 Product quality is poor 4 4
6 Fast response time 6 6
7 Impressive service 9 9
8 Product arrived damaged 10 10
9 Poor communication 8 8
10 Could improve delivery 7 7
time
Figure 10: Feedback
2.5 Wireframe

Figure 11: Wireframe Login


Figure 12: Wireframe Employee Information in the Director's Interface
Figure 13: Wireframe Add Employee in the Director's Interface
Figure 14: Wireframe List Product in the Manager's Interface
Figure 15: Wireframe Customer Information in the Manager's Interface
Figure 16:Wireframe Add Product in the Manager's Interface
Figure 17: Wireframe Client's Interface
Figure 18: Wireframe Cart In the Client's Interface
Figure 19: Wireframe Change Infomation In the Client's Interface
Figure 20:Wireframe Feedback In the Client's Interface

You might also like