Professional Documents
Culture Documents
AS2 - Le Thai Trung Tin - GCS210085
AS2 - Le Thai Trung Tin - GCS210085
AS2 - Le Thai Trung Tin - GCS210085
LE THAI TRUNG
Student Name Student ID GCS210085
TIN
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
1|Page
Assignment Brief 1 (RQF)
Higher National Certificate/Diploma in Computing
Unit Number and Title: Unit 04: Database Design & Development
Date:
Submission Format:
Format:
● The submission is in the form of an individual written report. This should be written in a concise, formal
business style using single spacing and font size 12. You are required to make use of headings, paragraphs
and subsections as appropriate, and all work must be supported with research and referenced using the
Harvard referencing system. Please also provide a bibliography using the Harvard referencing system.
Submission
● Students are compulsory to submit the assignment in due date and in a way requested by the Tutor.
● The form of submission will be a soft copy posted on http://cms.greenwich.edu.vn/.
● Remember to convert the word file into PDF file before the submission on CMS.
Note:
● The individual Assignment must be your own work, and not copied by or from another student.
● If you use ideas, quotes or data (such as diagrams) from books, journals or other sources, you must
reference your sources, using the Harvard style.
● Make sure that you understand and follow the guidelines to avoid plagiarism. Failure to comply this
requirement will result in a failed assignment.
2|Page
LO1 Use an appropriate design tool to design a relational database system for a substantial problem
You are employed as a Database Developer for a large IT consultancy company. The company has been approached
by FPT Shop which is expanding due to the growth of the number of stores. FPT Shop is currently facing
difficulties in dealing with managing the database from all shops on over country. It decided to develop a new
database so that: users can register with their phone numbers as IDs and order or rate, comment for their
bought devices, shop managers can take care for their stores and director board can view all data from all
shops.
You are tasked to select one of those systems to develop database for FPT Shop. Your tasks are to:
• Work with FPT Shop to find out about current requirements for each system
• Analyse the requirements and produce clear statements of user and system requirements.
• Design a relational database system using appropriate design tools and techniques
• Develop a fully functional relational database system, based on an existing system design.
• Test the system against user and system requirements.
• Produce technical and user documentation
Part 1 (Assignment 1)
Before you start the development process, your manager has asked you to produce a report for the CEO of FPT,
containing:
1. Clear statements of user and system requirements. The system must have at least 3 user roles, including
business processes and statistical reports for FPT Shop managers.
2. The design of the relational database system using appropriate design tools and techniques. It should
contain at least four interrelated tables.
You would prefer to produce a more detailed document, so you will produce a comprehensive design for a fully
functional system which will include interface and output designs, data validations and cover data normalization.
Your manager would like on the report your assessment of the effectiveness of the design in relation to user and
system requirements.
3|Page
TABLE CONTENTS
Assignment Brief 1 (RQF).............................................................................................................................2
Higher National Certificate/Diploma in Computing ..................................................................................2
1 TASK 3 - DEVELOP THE DATABASE SYSTEM (P2 – P3) .........................................................7
1.1 Final Mock-up of the application ....................................................................................................7
1.2 Queries to create database with results ...........................................................................................7
1.2.1 Queries to create database: ......................................................................................................7
2 Task 4 – Produce queries (P3) ..............................................................................................................10
2.1 Queries to INSERT data with illustrations of final result. ............................................................10
2.1.1 Insert Data for Staffs table and result: ...................................................................................10
2.1.2 Insert Data for Customers table result: ..................................................................................11
..............................................................................................................................................................11
2.1.3 Insert Data for table Products result: .....................................................................................11
2.1.4 Insert Data for Bills table and result: .....................................................................................12
2.1.5 Insert Data for Bill Detail table and result:............................................................................12
2.2 Queries to UPDATE data with illustrations of final result. ..........................................................12
2.2.1 Update data for Staff table and result: ...................................................................................12
2.2.2 Update data for Customer table and result: ...............................................................................13
2.2.2 Update data for Product table and result: ..............................................................................13
2.2.4 Updata data for Bill table and result: .....................................................................................14
2.2.5 Update data for Bill Detail table and result: ..........................................................................14
3 Queries to DELETE data with illustrations of final result .......................................................................15
3.1 Delete data for Staff table: .................................................................................................................15
3.2 Delete data for Customer table: .........................................................................................................15
3.3 Delete data for Product table:.............................................................................................................15
3.4 Delete data for Bill table: ...................................................................................................................15
3.5 Delete data for BillDetail table: .........................................................................................................16
4 Queries to SELECT data with illustrations of final result ........................................................................16
4.1. Select 1: Print out Bill with all information based on BillID............................................................16
4.2 Select 2: Print Bill with all information with condition total > 10000 ..............................................17
4.3 Select 3: Print out Bill with all information and Total based on BillID ............................................17
4.4. Select 4: Total sales of each Staff .....................................................................................................18
4.5. Select 5: Find Product(productID, productName, Price) with Price > = 300 .................................18
4|Page
4.6 Select 6: Find top 3 Product( productID, Highest_sell) best seller ....................................................18
4.7 select 7: Find top 3 Bill (billID) with highest quantity ......................................................................19
3 Task 5 –Test the system (P4) ....................................................................................................................19
3.1 Test Case ............................................................................................................................................19
Find Product(productID, productName, Price) with Price > = 300 .......................................................20
Find top 3 Product( productID, Highest_sell) best seller.........................................................................20
Find top 3 Bill (billID) with the most purchased quantity .......................................................................20
REFERENCE 1 ...........................................................................................................................................21
LIST OF FIGURE
Figure 1: Final Mock-Up of the application ..................................................................................................................7
Figure 2: Create Database of system ............................................................................................................................7
Figure 3: Create Staff table ...........................................................................................................................................8
Figure 4: Create Customer table...................................................................................................................................8
Figure 3: Create Product table......................................................................................................................................8
Figure 4: Create Bill table .............................................................................................................................................9
Figure 5: Create Bill Detail table ...................................................................................................................................9
Figure 6: Result of creating table ..................................................................................................................................9
Figure 7: Result ...........................................................................................................................................................10
Figure 8: Data for Staffs table and result....................................................................................................................11
Figure 10: Data for Product table and result ........................................................................................................11
Figure 11: Data for Bills table and result ..............................................................................................................12
Figure 12: Data for Bill Detail table and result ...........................................................................................................12
Figure 13:Update data for Staff table....................................................................................................................12
Figure 14: Update data for Customer table and result ..............................................................................................13
Figure 15: Update data for Product table...................................................................................................................13
Figure 16: Update data for Bill table and result .........................................................................................................14
Figure 17: Update data for Bill Detail table ................................................................................................................14
Figure 18: Delete data for Staff table .........................................................................................................................15
Figure 19: Delete data for Customer table .................................................................................................................15
Figure 20: Delete data for Product table ....................................................................................................................15
Figure 21: Delete data for Bill table ............................................................................................................................15
Figure 22: Delete data for Bill Detail table .................................................................................................................16
Figure 23: Select 1 ......................................................................................................................................................16
Figure 24: Select 2 ......................................................................................................................................................17
Figure 25: Select 3 ......................................................................................................................................................17
5|Page
Figure 26: Select 4 ......................................................................................................................................................18
Figure 27: Select 5 ......................................................................................................................................................18
Figure 28: Select 6 ......................................................................................................................................................19
Figure 29: Select 7 ......................................................................................................................................................19
6|Page
1 TASK 3 - DEVELOP THE DATABASE SYSTEM (P2 – P3)
7|Page
Figure 3: Create Staff table
Staff's information is stored from the beginning when the staff starts working. The maximum length of
the staff name is 50 characters. Staff is provided with an ID code of 0 to 6 characters long by the
company and attached to staff information. Employee addresses are limited to 50 characters and the
maximum employee phone number is 10 numbers.
8|Page
Figure 4: Create Bill table
Bill can output information related to customer, time, purchase address and employee at the time the
customer buys the product. Customers are saved information on the company's system and provided issue
a Bill showing the above information for customers to compare the correct information of the customer.
The Bill also helps senior managers see the sales of the stores in the system.
9|Page
Figure 7: Result
The four entities indicated on the ER (Entity Relationship) diagram will each have a primary key that
corresponds to that entity.
The relationships between entities can be 1 - n (1 - numerous), n - 1 or 1-1 relationships.
Bill Detail - Bill: Customers can purchase a variety of goods and have numerous bills and bills
information.
Staff- Bill: One employee may receive numerous bills.
Bill detail- Product: Customers can use one product for several Bill details. Customer-Bill: One customer
can receive many Bills Users can better comprehend the connections between entities and the pairing of
attributes with other entities by using ER diagrams.
2.1 Queries to INSERT data with illustrations of final result. Commented [SM1]:
10 | P a g e
Enter the necessary data into the Customer table. In the Customer table, you need to enter data
such as: CustomerID, CustomerName, CustomerPhone, CustomerAddress. CustomerID is limited
to 6 characters, CustomerName will be limited to 50 characters, CustomerPhone is limited to 10
characters, and CustomerAddress will be limited to 50 characters
Enter the necessary data in the Staff table. In the Staff table, you need to enter data such as:
staffID, staffName, staffPhone, staffAddress. StaffID is limited to 6 characters, staffName will be
limited to 50 characters, staffPhone is limited to 10 characters, staffAddress will be limited to 50
characters.
Enter the necessary data into the Product table. In the Customer table, you need to enter data such
as: ProductID, ProductName, Unit and Price. ProductID is limited to 6 characters, ProductName
will be limited to 50 characters, Unit is limited to 15 characters, the rest is Price, which will be
numbered with the 'float' function.
11 | P a g e
2.1.4 Insert Data for Bills table and result:
Enter the required data in the Bill table. In the Bill table, you need to enter data such as: BillID,
BillDate, staffID and customerID. BillID is limited to 6 characters, BillDate will be entered with
the 'date' function, StaffID is limited to 6 characters and the remaining customerID will be limited
to 6 characters.
12 | P a g e
Similar to updating customer data, updating employee data will also be the same. You can update and
change all information in the Staff's table.
13 | P a g e
2.2.4 Updata data for Bill table and result:
Similar to updating customer data, Billdetail's data update will be the same. You can update and
change all the information in the BillDetail table.
14 | P a g e
3 Queries to DELETE data with illustrations of final result
15 | P a g e
3.5 Delete data for BillDetail table:
4.1. Select 1: Print out Bill with all information based on BillID
16 | P a g e
4.2 Select 2: Print Bill with all information with condition total > 10000
4.3 Select 3: Print out Bill with all information and Total based on BillID
17 | P a g e
4.4. Select 4: Total sales of each Staff
4.5. Select 5: Find Product(productID, productName, Price) with Price > = 300
18 | P a g e
Figure 28: Select 6
Select 6 it has the function to query the top 3 best selling products
19 | P a g e
3 Print out Bill with all B.billID, B.billDate,
information and Total C.customerName,S.staffNam
based on BillID e, P.productName, P.Price,
BD.quantity, P.Price *
BD.quantity as Amount
5 productID, productName,
Find Price
Product(productID,
productName, Price)
with Price > = 300
6 productID, sum(quantity) as
Find top 3 Product( Highest_sell
productID,
Highest_sell) best seller
7 billID, sum(quantity) as
Find top 3 Bill (billID) Most_purchase
with the most
purchased quantity
20 | P a g e
REFERENCE 1
1.Vncoder.vn. 2022. Bài 5: Kiểu dữ liệu trong SQL Server - Học SQL Server cơ bản. [online]
Available at: [Accessed 12 October 2022].
2.www.vietjack.com. 2022. CREATE Table trong SQL - Tạo bảng trong SQL. [online] Available at:
[Accessed 12 October 2022].
3.Tutorialspoint.com. 2022. SQL - Overview. [online] Available at: [Accessed 12 October 2022].
4. Software, S., 2022. Physical Database Design - Sesame Software & Relational Junction. [online]
Sesame Software. Available at: [Accessed 12 October 2022].
5. Draw.io. 2022. Flowchart Maker & Online Diagram Software. [online] Available at: [Accessed 12
October 2022]
21 | P a g e