AS2 - Le Thai Trung Tin - GCS210085

You might also like

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

Higher Nationals in Computing

Database Design and


Development
ASSIGNMENT
No.1

Learner’s name: LE THAI TRUNG TIN


Assessor name: NGUYEN VAN SON
Class: GCS1005A
Learner’s ID: GCS210085
Subject’s ID: 1622
Assignment due:12/10/2022
Assignment submitted:23/10/2022
ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and


Unit 04: Database Design & Development
title

Date Received 1st


Submission date 23/10/2022
submission

Date Received 2nd


Re-submission Date
submission

LE THAI TRUNG
Student Name Student ID GCS210085
TIN

Class GCS1005A Assessor name

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

 Summative Feedback:  Resubmission Feedback:\

Grade: Assessor Signature: Date:


Lecturer Signature:

1|Page
Assignment Brief 1 (RQF)
Higher National Certificate/Diploma in Computing

Student Name/ID Number: LE THAI TRUNG TIN/GCS210085

Unit Number and Title: Unit 04: Database Design & Development

Academic Year: 2022

Unit Assessor: Nguyen Van Son

Assignment Title: Database design

Issue Date: 12/10/2022

Submission Date: 23/10/2022

Internal Verifier Name:

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.

Unit Learning Outcomes:

2|Page
LO1 Use an appropriate design tool to design a relational database system for a substantial problem

Assignment Brief and Guidance:

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.

Learning Outcomes and Assessment Criteria (Assignment 1):


Learning Outcome Pass Merit Distinction
LO1 P1 Design a relational M1 Produce a D1 Assess the
database system using comprehensive design effectiveness of the
appropriate design tools for a fully functional design in relation to user
and techniques, system which includes and system
containing at least four interface and output requirements.
interrelated tables, with designs, data
clear statements of user validations and data
and system normalisation.
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)

1.1 Final Mock-up of the application

Figure 1: Final Mock-Up of the application

1.2 Queries to create database with results

1.2.1 Queries to create database:

The initial step in developing the system is to generate the database.

Figure 2: Create Database of system

Then, as illustrated in the design, we must build the data tables.

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.

Figure 4: Create Customer table


Staff enter new information on Customer's system. ID code can enter up to 6 numbers. Name and address
can enter up to 50 characters and can enter Vietnamese. Customer's phone number is maximum 10
numbers The customer's information is closely linked with the customer's ID, so the Id code is the main
code of the customer.

Figure 3: Create Product table


Each type of product will be entered a separate ID code and represent each type of product. Based on the
product type ID code, the name of the product type can be identified. The id code can be up to 6 numbers
and the product Figure 5: Table BillDetail 8 | P a g e name can be up to 50 characters long. The product
information is changed if the managers approved by senior management.

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.

Figure 5: Create Bill Detail table


BillDetail information is additional data that is hidden from customers. The team can view and monitor
customer support using this data. Billdetail operates using the Shop's information and the Staff ID code.
The BillID part of the ID code creates and prints the Bill.
The table's foreign and primary keys are produced during its construction, and the following is the result:

Figure 6: Result of creating table

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 Task 4 – Produce queries (P3)

2.1 Queries to INSERT data with illustrations of final result. Commented [SM1]:

2.1.1 Insert Data for Staffs table and result:

Figure 8: Data for Customers table and result

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

2.1.2 Insert Data for Customers table result:

Figure 9: Data for Staffs table and result

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.

2.1.3 Insert Data for table Products result:

Figure 10: Data for Product table and result

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:

Figure 11: 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.

2.1.5 Insert Data for Bill Detail table and result:

Figure 12: Data for Bill Detail table and result


Enter the required data into the BillDetail table. In the BillDetail table, you need to enter data such as:
BillID, ProductID, Quantity. BillID is limited to 6 characters, ProductID will be limited to 6
characters, Quantity will be entered by the 'Float' function.

2.2 Queries to UPDATE data with illustrations of final result.

2.2.1 Update data for Staff table and result:

Figure 13:Update data for Staff table

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.

2.2.2 Update data for Customer table and result:

Figure 14: Update data for Customer table and result


Updating customer data is that you can change the data in it like you can change the customer's phone
number, address, ID and even the customer's name.

2.2.2 Update data for Product table and result:

Figure 15: Update data for Product table


Similar to updating customer data, updating product data will also be the same. You can update and
change all the information in the product's table.

13 | P a g e
2.2.4 Updata data for Bill table and result:

Figure 16: Update data for Bill table and result


Similar to updating customer data, Bill's data update will be the same. You can update and change all
the information in the Bill table.

2.2.5 Update data for Bill Detail table and result:

Figure 17: Update data for Bill Detail table

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

3.1 Delete data for Staff table:

Figure 18: Delete data for Staff table

3.2 Delete data for Customer table:

Figure 19: Delete data for Customer table

3.3 Delete data for Product table:

Figure 20: Delete data for Product table

3.4 Delete data for Bill table:

Figure 21: Delete data for Bill table

15 | P a g e
3.5 Delete data for BillDetail table:

Figure 22: Delete data for Bill Detail table

4 Queries to SELECT data with illustrations of final result

4.1. Select 1: Print out Bill with all information based on BillID

Figure 23: Select 1


Select 1 it has the function to print out all information based on the BillID column.

16 | P a g e
4.2 Select 2: Print Bill with all information with condition total > 10000

Figure 24: Select 2


Select 2 it has the function of printing out all information based on the BillID column and
will have an additional total column to be more complete and there will be one more
condition that total > 10000

4.3 Select 3: Print out Bill with all information and Total based on BillID

Figure 25: Select 3


Select 3 it has the function of printing out all information based on the BillID column and
will have a total column for more completeness.

17 | P a g e
4.4. Select 4: Total sales of each Staff

Figure 26: Select 4


Select 4 it has the function to print the total amount of money of each employee when
hight selling and will calculate the total amount of products sold by the employee.

4.5. Select 5: Find Product(productID, productName, Price) with Price > = 300

Figure 27: Select 5

4.6 Select 6: Find top 3 Product( productID, Highest_sell) best seller

18 | P a g e
Figure 28: Select 6
Select 6 it has the function to query the top 3 best selling products

4.7 select 7: Find top 3 Bill (billID) with highest quantity

Figure 29: Select 7


Select 7 it has the function to query the top 3 biill with the highest quantity
3 Task 5 –Test the system (P4)

3.1 Test Case

NO TEST CASE TEST DATA RESULT

1 Print out Bill with all B.billID, B.billDate,


information based on C.customerName,S.staffNam
BillID e, P.productName, P.Price,
BD.quantity

2 Print Bill with all B.billID, B.billDate,


information with C.customerName,S.staffNam
condition total > 10000 e, P.productName, P.Price,
BD.quantity, P.Price *
BD.quantity as Amount

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

4 Total sales of each Staff S.staffID, S.staffName,


sum(BD.quantity * P.Price)
as Revenue

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

You might also like