Docsity

Database Design Assignment, Assignments of Database Programming

Toggle sidebar
bg1
Report Structure
Chapter 1 - Statements of user and system requirements
1.1 Overview about the Problem
According to Tri (2021) the number of FPT Shop chain has increased significantly in recent years.
The total number of stores is 625 with around 30 newly opened stores in 2021. Regarding the huge
expansion of the company, it seems that the current management system that is used by FPT Shop is
outdated. Thus, the company now needs a new database management system to handle huge amount
of data from all stores. The following section of the report will highlight some requirements of the
new application.
1.2 Requirements of the application
1.2.1 User roles
The new database management system will have following 5 user roles:
Customers
Employees – Retailers
Store managers
Director board
1.2.2 Application requirements
This section of the report outlines some requirements based on user roles identified above:
Customers:
As a customer, I want to view the available items at specific stores so that I can place orders.
As a customer, I want to able to query or search for items based on items’ name and prices
so that my buying experience is more convenient.
As a customer, I want to able to rate or comment on my orders so that I can give feedbacks
to enhance stores’ services.
Employees:
As an employee, I want to able to query or search for items based on items’ name and prices
so that I can make recommendation to customers.
As an employee, I want to able to view and search customers’ orders so that I can response
to customers’ queries regarding that order.
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15

Partial preview of the text

Download Database Design Assignment and more Assignments Database Programming in PDF only on Docsity!

Report Structure

Chapter 1 - Statements of user and system requirements 1.1 Overview about the Problem According to Tri (2021) the number of FPT Shop chain has increased significantly in recent years. The total number of stores is 625 with around 30 newly opened stores in 2021. Regarding the huge expansion of the company, it seems that the current management system that is used by FPT Shop is outdated. Thus, the company now needs a new database management system to handle huge amount of data from all stores. The following section of the report will highlight some requirements of the new application. 1.2 Requirements of the application 1.2.1 User roles The new database management system will have following 5 user roles:  Customers  Employees – Retailers  Store managers  Director board 1.2.2 Application requirements This section of the report outlines some requirements based on user roles identified above: Customers:  As a customer, I want to view the available items at specific stores so that I can place orders.  As a customer, I want to able to query or search for items based on items’ name and prices so that my buying experience is more convenient.  As a customer, I want to able to rate or comment on my orders so that I can give feedbacks to enhance stores’ services. Employees:  As an employee, I want to able to query or search for items based on items’ name and prices so that I can make recommendation to customers.  As an employee, I want to able to view and search customers’ orders so that I can response to customers’ queries regarding that order.

Store managers:  As a store manager, I want to able to view my own store’s performance so that I can make informed management decision. Board director:  As a board director, I want to able to view all store’s performance so that I can make informed management decision.  As a board director, I want to able to get automate report on store and region performance so that I can make informed management decision. Chapter 2 – Design the relational database system 2.1 Analyse the requirements Based on the above requirements, this section of the report will conduct a brief analysis regarding the number of tables of the application, users’ permissions as well as identifying some advanced statistical action that the application should have. 2.1.1 Database tables & users’ permissions First of all, the CRUD actions stand for Create (C), Read (R), Update (U), and Delete (D). It determines the action that users can do on the system or interact with the database. The following table illustrates a basic CRUD action for each role in relation to database tables. Database tables Customer Employee Manager Director Customer CRUD (own) R (all) R (all) R (all) Orders CRUD (own) R (all) RU (all) R (all) OrderDetail CRUD (own) R (all) RU (all) R (all) Payment CRUD (own) R (all)) R (all)) R (all) Product R (all) R (all) R (all) R (all) Category R (all) R (all) R (all) R (all) Store RU (store) RU (all) Employee RU (own) CRUD (store) CRUD (all) Role R (store) CRU (all)

2.2.1 Tables Customers This table is used to store information about customers. The primary key is the unique customer_id. Each customer profile has information such as first_name, last_name, phone, email and so on. Orders This table is used to store information about orders that are places by customers. The primary key is the unique order_id. Each order has information such as customer_id (the customer who place the order), order_status (the state of the order, it can be unprocessed, processed, shipped, finished, cancelled, and refunded), the order will also have store_id and staff_id to refer to the staff that handle the order.

Order Details While the Orders table above is used to store the general information of an order, this table is used to store information about the items that customers purchase. It includes information such as product_id, price, the number of purchased item. Employees This table is used to store information about employees of the company. Besides the personal information of the staff, information such as the store_id that the staff work, and the direct manager information are also included. Brands This table is used to store information about the brands of the product.

RateNComment This table manage the rating and comment that customers may have with their orders. Payments This table manage the payment type. It can be cash, online banking, Visa/Mastercard or Paypal. Stocks This table manage the information of quantities of the product and the store where the product can be ready for sale. Overall, the reason for having tables such as categories instead of only having products is that it can help FPT store to better management their inventory. In addition, some customers are also preferring to query product by category. Therefore, managing these tables separately will help to improve the query efficiency.

Table relationships – Crow foot notation style

//blah blah blah [orders] To [employees] //blah blah blah

b. Order Details [order_details] To [orders] //blah blah blah

//blah blah blah [employees] To [role] //blah blah blah

d. Products [products] To [brands] //blah blah blah

[stocks] To [stores] //blah blah blah f. Rate and Comment [rate_n_comment] To [customers] //blah blah blah

[rate_n_comment] To [order_details] //blah blah blah 2.2.1 Review whether the database is normalized

2.4.1 NOT NULL

There are legitimate use cases for NULLS, but there are also clear situations when we cannot accept a NULL value. In these circumstances, a NOT NULL constraint on a column can be defined. In the example below, we are creating an customers table, and specifying that some important columns will not accept NULLs. 2.4.2 UNIQUE With the special requirements: Customer can register with their phone numbers as IDs and login to the system to order or take a rate or comment. So that, we need to ensure their phone numbers are UNIQUE. 2.4.3 CONSTRAINT A check constraint uses a logical expression to specify which values are acceptable. The following figure shows the rule that the “quantity” of the products must be a positive integer in a stock. The director of manager must keep the ready state of the number of products for the business.

In this case of the table rate_n_comment as below, I put the constraint to determine the level of rating for the product. Customers can rate 1 to 5 “stars” for every item they bought. With products table, the unit_price of the product is an important and needed information. So that, a constraint to check the positive pricing is necessary. 2.5 Wireframe of the application References Tri T. 2021, ‘FPT Retail (FRT): Profits before tax of VND 76 billion in the first half of the year, up 189% compared to the same period’, viewed 30 June 2022, <http://frt.vn/en/tag/fpt-shop/#:~:text=total%20consolidated%20revenue.-,Regarding%20the %20store%20network%2C%20by%20the%20end%20of%20the%20first,to%20the%20beginning %20of%202021>.