Uploaded by Phan Trong Nhan (FGW DN)

asm2

advertisement
ASSIGNMENT 2 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
Phan Trọng Nhân
Student ID
GCD191134
Class
GCD1103
Assessor name
Mr.Phi
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
P2
P3
P4
P5
M2
M3
M4
M5
D2
D3
 Summative Feedback:
Grade:
Signature & Date:
 Resubmission Feedback:
Assessor Signature:
Date:
Table of Contents
P1. Design a relational database system using appropriate design tools and techniques, containing at least four interrelated tables, with clear
statements of user and system requirements ............................................................................................................................................................... 6
I.
Overview about the problem ............................................................................................................................................................................. 6
1.
Scenario.......................................................................................................................................................................................................... 6
2.
Overview about the problem ......................................................................................................................................................................... 7
3.
Requirements of application.......................................................................................................................................................................... 7
II.
Design the relational database system .............................................................................................................................................................. 7
1.
Analyse The Requirements ............................................................................................................................................................................ 7
2.
Database Design with explanations ............................................................................................................................................................... 8
3.
Wireframe of the validation......................................................................................................................................................................... 10
4.
Create databases and tables ........................................................................................................................................................................ 13
5.
Create Database Diagram ............................................................................................................................................................................ 17
6.
Data entry for tables .................................................................................................................................................................................... 17
P2. Develop the database system with evidence of user interface, output and datavalidation, and querying across multiples tables .................... 22
1.
Develop the database system with evidence .................................................................................................................................................. 22
a.
User interface............................................................................................................................................................................................... 22
b.
Data validations ........................................................................................................................................................................................... 26
C.
Querying across multiple tables .................................................................................................................................................................. 29
P3. Implement a query language into the relation database system .......................................................................................................................... 32
a.
PRODUCT table: ........................................................................................................................................................................................... 32
b.
CUSTOMER table:......................................................................................................................................................................................... 35
c.
ORDERS table ............................................................................................................................................................................................... 37
d.
STAFF table................................................................................................................................................................................................... 39
e.
DETAILS table ............................................................................................................................................................................................... 41
f.
SUPLIERS table ............................................................................................................................................................................................. 43
P4. Test the system against and test system requirements ........................................................................................................................................ 45
1.
Test case........................................................................................................................................................................................................... 45
2.
Test log ............................................................................................................................................................................................................. 46
P5. Produce technical and user documentation .......................................................................................................................................................... 47
Table of figures
Figure 1 ERD ................................................................................................................................................................................................................... 9
Figure 2 Customer Table with tool............................................................................................................................................................................... 13
Figure 3 Product Table with tool.................................................................................................................................................................................. 14
Figure 4 Order table with tool ..................................................................................................................................................................................... 14
Figure 5 Staff table with tool ....................................................................................................................................................................................... 15
Figure 6 Details table with tool .................................................................................................................................................................................... 16
Figure 7 SUPLIERS table with tool ................................................................................................................................................................................ 16
Figure 8 Database Diagram ......................................................................................................................................................................................... 17
Figure 9 Customer's Data ............................................................................................................................................................................................. 18
Figure 10 Product's Data .............................................................................................................................................................................................. 18
Figure 11 Order's Data ................................................................................................................................................................................................. 19
Figure 12 Staff's Data ................................................................................................................................................................................................... 20
Figure 13 Details's Data ............................................................................................................................................................................................... 20
Figure 14 Supliers's Data .............................................................................................................................................................................................. 21
Figure 15 Customer View ............................................................................................................................................................................................. 22
Figure 16 Products view ............................................................................................................................................................................................... 23
Figure 17 Details view .................................................................................................................................................................................................. 24
Figure 18 Orders view .................................................................................................................................................................................................. 24
Figure 19 staff view ...................................................................................................................................................................................................... 25
Figure 20 Supliers view ................................................................................................................................................................................................ 26
Figure 21 The result of select Queries ......................................................................................................................................................................... 30
Figure 22 The result of select Queries ......................................................................................................................................................................... 31
Figure 23 The result of select queries .......................................................................................................................................................................... 32
Figure 24 Result of insert data for product table ........................................................................................................................................................ 33
Figure 25 Result of update data for product table ...................................................................................................................................................... 34
Figure 26 Result of delete data for product table ....................................................................................................................................................... 35
Figure 27 Result of insert data for Customer table ..................................................................................................................................................... 35
Figure 28 Result of update data for Customer table ................................................................................................................................................... 36
Figure 29 Result of delete data for Customer table .................................................................................................................................................... 36
Figure 30 Result of insert data for Orders table .......................................................................................................................................................... 37
Figure 31 Result of update data for Orders table ........................................................................................................................................................ 38
Figure 32 Result of delete data for Orders table ......................................................................................................................................................... 38
Figure 33 Result of insert data for Staff table .............................................................................................................................................................. 39
Figure 34 Result of update data for Staff table............................................................................................................................................................ 40
Figure 35 Result of delete data for Staff table ............................................................................................................................................................. 40
Figure 36 Result of insert data for Details table .......................................................................................................................................................... 41
Figure 37 Result of update data for Details table ........................................................................................................................................................ 42
Figure 38 Result of delete data for Details table ......................................................................................................................................................... 42
Figure 39 Result of insert data for Supliers table ........................................................................................................................................................ 43
Figure 40 Result of update data for Supliers table ...................................................................................................................................................... 44
Figure 41 Result of delete data for Supliers table ....................................................................................................................................................... 44
P1. Design a relational database system using appropriate design
tools and techniques, containing at least four interrelated tables,
with clear statements of user and system requirements
I. Overview about the problem
1. Scenario
I am 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.
2. Overview about the problem
Database design to build a database for FPT Shop includes the following tables: Customers, Products, Orders, Details, Employees,
Suppliers.In small and medium-sized shops, they manage data or revenue based on customer invoices, books, etc. This is not really
accurate, easy to make mistakes, and the management based on invoices is easy to fail. exit because it is difficult to store, leading to
errors.
Currently, stores have many different ways to manage data such as on excel, on books (this is no longer popular, only applied to small
establishments), to manage big data, it is necessary to build a database. database. data on software such as MariaDB, My SQL, Redis,
MongoDB,...
3. Requirements of application
The requirement for the fpt shop management application to be built is:
•
•
•
•
•
Store data all stores
Store goods, passengers, orders, etc.
Retrieve data when required
Periodic data statistics
data backup,
II. Design the relational database system
1. Analyse The Requirements
Customers :
As a Customer, I want to search products so that I can choose buy
As a Customer, I want to view products so that I can know well the products
As a Customer, I want to order products so that I can buy them
As a Customer, I want to place an order products so that I can check out
As a Customer, I want to check my order so that I can know make sure what I want to buy
As a Customer, I want to check the my order status so that I can know where my products are.
Staff:
As a Staff, I want to input products so that I can manage products
As a Staff, I want to view orders so that I can approve orders
As a Staff, I want to statistic products so that I can know the products quantity
As a Staff, I want to products so that I can manage products …
Manager
As a Manager, I want to view the products lists so that I can manage products
As a Manager, I want to view revenue by day/ by week/ by month so that I can manage shops
As a Manager, I want to manage my staff so that I can pay them.
2. Database Design with explanations
a) Enitities
After the requirements annalysis, we can identify the enitities as follows:
-
Customer have the following characteristics : CID, name, address, phone number, email
b)
Product have the following characteristics : PID, name , price, date, suplier…
Orders have the following characteristics : OID, CustomerID, StaffID, Date
Staff have the following characteristics : SID, Name, Add, Salary
ERD
Figure 1 ERD
Figure 1 shows the ER diagram of the Fpt shop system. From this figure we can see that the relationships are as follows:
The Customers table has 1 - n relationship with the Orders table because each Customer can have many orders, but 1 order belongs to
only 1 Customer.
The Staff table has 1 – n relationship with Orders table because each Staff can have many Orders, but 1 order belongs to only 1 staff
manage.
The Products table has 1- n relationship with Detail table because each Product can have many details, but 1 Detail belongs to only 1
Product.
The Order table has 1 – n relationship with Detail table because each Order can have many details, but 1 Detail belongs to only 1
Order.
The Products table has 1 – n relationship with Supliers table because each products can have many Supliers, but 1 Suplier belong to
only 1 Products.
3. Wireframe of the validation
a) PRODUCT table
This table is used to store all information of product. It has serveral columns such as: PID, Name, Price, Quantity, SupID,
SupName Among these, PID is primary key. The column Name must be not null and Price and Quantity must be bigger than zero
(>0). The detail of table product is shown as follow:
Column name
Data Tye
Allow null
Contraint
PID
Nvarchar(10)
no
PK
Name
Nvarchar(50)
No
Unique
Price
Int
no
Check (price >0)
Quantity
int
No
Check
(Quantity>0)
SupID
Nvarchar(10)
No
b) CUSTOMER table:
This table is used to store all information of product. It has serveral columns such as: CID, CustomerName, CustomerPhone,
CustomerADD among these, CID is primary key. The column CustomerName must be not null. The detail of table product is shown
as follow:
Column Name
CID
CustomerName
CustomerPhone
CustomerAdd
Data Type
Nchar(10)
Nvarchar(50)
Nchar(15)
Nvarchar(50)
Allow Null
No
No
No
No
Contraint
PK
c) STAFF table
This table is used to store all information of product. It has serveral columns such as: SID, StaffName, StaffPhone, StaffADD,
Salary among these, SID is primary key. The column StaffName must be not null, Salary must be bigger than zero(>0) . The detail
of table product is shown as follow:
Column Name
SID
StaffName
StaffPhone
StaffAdd
Salary
Data Type
Nchar(10)
Nvarchar(50)
Nvarchar(15)
Nvarchar(50)
Int
Allow Null
No
No
No
No
No
Contraint
PK
Check (salary >0)
d) ORDERS table
This table is used to store all information of product. It has serveral columns such as: OID, CustomerID, StaffID, OrderDate among
these, OID is primary key. The column CustomerID and StaffID must be not null and OrderDate is greater than or equal to current
date . The detail of table product is shown as follow:
Column Name
OID
Data Type
Nchar(10)
Allow Null
No
Contraint
PK
CustomerID
StaffID
OderDate
Nchar(10)
Nchar(10)
Date
No
No
No
Unique
Unique
Check( orderDate >= current
date)
e) DETAILS table
This table is used to store all information of product. It has serveral columns such as: OID, PID, Quantity, price among these, OID
and PIDis primary key. The column Quantity and Price must be bigger than zero(>0). The detail of table product is shown as follow:
Column Name
OID
PID
Quantity
Price
Data Type
Nvarchar(10
Nvarchar(10)
Int
Int
Allow Null
No
No
No
No
Contraint
Pk
PK
Check (quantity >0)
Check (price >0)
f) SUPLIERS table
This table is used to store all information of product. It has serveral columns such as: SupID, SupName among these, SupID is
primary key. The column SupName must be not null . The detail of table product is shown as follow:
Column Name
SupID
SupName
Data Type
Nvarchar(10)
Nvarchar(50)
Allow Null
No
No
Contraint
Pk
Unique
4. Create databases and tables
Customer table:
a) Create table with Tool:
Figure 2 Customer Table with tool
b) Create table by use SQL:
Create Table CUSTOMER (
CID nchar(10) Not null
Primary key,
CustomerName nvarchar(50) not null,
CustomerPhone nchar(15) not null,
CustomerAdd nvarchar(50)
)
Product Table:
a) Create table with tool:
Figure 3 Product Table with tool
b) Create table by use SQL
Create Table PRODUCT (
PID nvarchar(10) Not Null Primary KEY,
Name nvarchar(50) Not Null Unique,
Price int Check(Price >0),
Quantity int check(Quantity >0)
)
Order Table :
a) Create table with tool
Figure 4 Order table with tool
b) Create table by use SQL
Create table ORDERS (
OID nchar(10) not null Primary key,
CustomerID nchar(10) References CUSTOMER(CID),
StaffID nchar(10) References STAFF(StaffID) ,
ORDERDATE date check (ORDERDATE >= CurrentDate) not null
)
Staff Table:
a) Create table with tool:
Figure 5 Staff table with tool
b) Create table by use SQL:
Create Table STAFF (
StaffID nchar(10) Not null Primary key,
StaffName nvarchar(50) not null,
StaffPhone nvarchar(15) not null,
StaffAdd nvarchar(50),
Salary int check(Salary >0) not null
)
Details Table:
a) Create table with tool:
Figure 6 Details table with tool
b) Create table by use SQL:
Create table DETAILS(
OID nchar(10) References ORDERS(OID),
PID nvarchar(10) References PRODUCT(PID),
QUANTITY INT CHECK (QUANTITY >0),
PRICE INT CHECK (PRICE >0),
CONSTRAINT PK PRIMARY KEY(OID, PID)
)
SUPLIERS Table
a) Create table with tool:
Figure 7 SUPLIERS table with tool
5. Create Database Diagram
Figure 8 Database Diagram
6. Data entry for tables
a) CUSTOMER Table:
insert into CUSTOMER
values ('KH01', 'Le Hoang', '0777415163', '23 Le Duan, Da Nang'),
('KH02', 'Le Van Nhan', '0905241148', '25 Ngo Quyen, Da Nang'),
('KH03', 'Phan Thi Thanh Hang', '0901951746', '52 Mac Thi Buoi, Da Nang'),
('KH04', 'Phan Thi Thanh Nga', '0586271152', '502 Nui Thanh, Da Nang'),
('KH05', 'Dang Ngoc Lien', '0906469129', '65 Hoang Van Thu, Da Nang')
The result after enter data:
Figure 9 Customer's Data
b) PRODUCT table:
insert into PRODUCT
values ('ip12prm', 'IPHONE12 PROMAX', '18000000', '7', 'SUP01'),
('ip14', 'IPHONE14', '20000000', '15', 'SUP02'),
('iP14pr', 'IPHONE14 PRO', '22000000', '10', 'SUP03'),
('ip14prm', 'IPHONE14 PROMAX', '27000000', '10', 'SUP04'),
('mba', 'MacbookAir', '30000000', '20', 'SUP05')
The result after enter data:
Figure 10 Product's Data
c) ORDERS table:
insert into ORDERS
values ('O01', 'KH01', 'NV01', '2023-01-09'),
('O02', 'KH03', 'NV02', '2022-12-15'),
('O03', 'KH02', 'NV04', '2022-09-27'),
('O04', 'KH05', 'NV03', '2022-07-06'),
('O05', 'KH04', 'NV05', '2022-03-17')
The result after enter data:
Figure 11 Order's Data
d) STAFF table:
insert into STAFF
values
('NV01',
('NV02',
('NV03',
('NV04',
('NV05',
'Le Quoc Hung', '0765231542', '122 Nguyen Hoang, Da Nang', '7000000'),
'Nguyen Thanh Sang', '0905897141', '95 Bui Ta Han, Da Nang', '7000000'),
'Tran THi Thanh Tam', '0868235957', '15 Le Loi, Da Nang', '5000000'),
'Le Bao Quyen', '0901238147', '127/13 Nguyen Cong Tru, Da Nang', '10000000'),
'Nguyen Thanh Tung', '0926641148', '125 Nguyen Chi Thanh, Da Nang', '12000000')
The result after enter data:
Figure 12 Staff's Data
e) DETAILS table:
insert into DETAILS
values
('O01', 'ip14', '4', '22000000'),
('O02', 'iP14pr', '3', '24000000'),
('O03', 'ip14prm', '4', '30000000'),
('O04', 'ip12prm', '7', '19000000'),
('O05', 'mba', '10', '32000000')
The result after enter data:
Figure 13 Details's Data
f) SUPLIERS table
insert into SUPLIERS
values ('SUP01', 'FPT SHOP'),
('SUP02', ' THE GIOI DI DONG'),
('SUP03', ' XIAOMI'),
('SUP04', ' DIEN MAY XANH'),
('SUP05', ' VIETTEL STORE'),
('SUP06', ' HOANG HA MOBILE')
The result after enter data:
Figure 14 Supliers's Data
P2. Develop the database system with evidence of user
interface, output and datavalidation, and querying across
multiples tables
1. Develop the database system with evidence
a. User interface
To create user interfaces, I will create data entry views for users. For each table there will be 1 view
•
CUSTOMER table
Create view by use SQL:
Create view NhapCustomers as
Select *
from CUSTOMER
with check option
The result of Customer view:
Figure 15 Customer View
•
PRODUCT table:
Create view by use SQL:
Create view NhapProducts as
Select *
from PRODUCT
with check option
The result of Product view:
Figure 16 Products view
•
DETAILS table:
Create view by use SQL:
Create view NhapDETAILS as
Select *
from DETAILS
with check option
The result of Details view:
Figure 17 Details view
•
ORDERS table:
Create view by use SQL:
Create view NhapORDERS as
Select *
from ORDERS
with check option
The result of Orders view:
Figure 18 Orders view
• STAFF table:
Create view by use SQL:
Create view NhapStaff as
select *
from STAFF
with check option
The result of Staff view:
Figure 19 staff view
• SUPLIERS table:
Create view by use SQL:
Create view NhapSupliers as
Select *
from SUPLIERS
with check option
The result of Supliers view:
Figure 20 Supliers view
b. Data validations
•
PRODUCT table:
Column name
Data Tye
Allow null
Contraint
PID
Nvarchar(10)
no
PK
Name
Nvarchar(50)
No
Unique
Price
Int
no
Check (price >0)
Quantity
int
No
Check
(Quantity>0)
SupID
Nvarchar(10)
No
Queries for PRODUCT table:
Create Table PRODUCT (
PID nvarchar(10) Not Null Primary KEY,
Name nvarchar(50) Not Null Unique,
Price int Check(Price >0),
Quantity int check(Quantity >0)
)
•
CUSTOMER table:
Column Name
CID
CustomerName
CustomerPhone
CustomerAdd
Data Type
Nchar(10)
Nvarchar(50)
Nchar(15)
Nvarchar(50)
Allow Null
No
No
No
No
Contraint
PK
Queries for CUSTOMER table:
Create Table CUSTOMER (
CID nchar(10) Not null
Primary key,
CustomerName nvarchar(50) not null,
CustomerPhone nchar(15) not null,
CustomerAdd nvarchar(50)
)
•
DETAILS table:
Column Name
OID
PID
Quantity
Price
Queries for DETAILS table:
Data Type
Nvarchar(10
Nvarchar(10)
Int
Int
Allow Null
No
No
No
No
Contraint
Pk
PK
Check (quantity >0)
Check (price >0)
Create table DETAILS(
OID nchar(10) References ORDERS(OID),
PID nvarchar(10) References PRODUCT(PID),
QUANTITY INT CHECK (QUANTITY >0),
PRICE INT CHECK (PRICE >0),
CONSTRAINT PK PRIMARY KEY(OID, PID)
)
•
ORDERS table:
Column Name
OID
CustomerID
StaffID
OderDate
Data Type
Nchar(10)
Nchar(10)
Nchar(10)
Date
Allow Null
No
No
No
No
Contraint
PK
Unique
Unique
Check( orderDate >= current
date)
Allow Null
No
No
No
No
No
Contraint
PK
Queries for ORDERS table:
Create table ORDERS (
OID nchar(10) not null Primary key,
CustomerID nchar(10) References CUSTOMER(CID),
StaffID nchar(10) References STAFF(StaffID) ,
ORDERDATE date check (ORDERDATE >= CurrentDate) not null
)
•
STAFF table:
Column Name
SID
StaffName
StaffPhone
StaffAdd
Salary
Queries for STAFF table:
Data Type
Nchar(10)
Nvarchar(50)
Nvarchar(15)
Nvarchar(50)
Int
Check (salary >0)
Create Table STAFF (
StaffID nchar(10) Not null Primary key,
StaffName nvarchar(50) not null,
StaffPhone nvarchar(15) not null,
StaffAdd nvarchar(50),
Salary int check(Salary >0) not null
)
•
SUPLIERS table:
Column Name
SupID
SupName
Data Type
Nvarchar(10)
Nvarchar(50)
Allow Null
No
No
Contraint
Pk
Unique
C. Querying across multiple tables
Queries 1: Presented by employee 01: StaffID, StaffName,PID , Quantity, Price and total amount
•
Queries:
Select S.staffID, StaffName, PID, Quantity, Price, Quantity * Price 'Total Amount'
from Staff S inner join Orders O on S.StaffID = O.StaffID
inner join DETAILS D on D.OID = O.OID
where S.StaffID = 'NV01'
•
The result of Queries 1:
Figure 21 The result of select Queries
Queries 2: Revenue statistics by employee: StaffName, Total
•
Queries:
Select StaffName, Sum(Quantity * Price) 'Total'
From Staff S inner join ORDERS O on S.StaffID = O.StaffID
inner join DETAILS D on D.OID = O.OID
group by StaffName
•
The result of Queries 2:
Figure 22 The result of select Queries
Queries 3: display OID, customerName, productName, quantity, price and total amount
•
Queries:
select D.OID, C.CustomerName, P.Name, D.Quantity, D.Price, D.Quantity * D.Price 'ToTal Amount'
from ORDERS O inner join CUSTOMER C on O.CustomerID = C.CID
inner join DETAILS D On O.OID = D.OID
inner join PRODUCT P on P.PID = D.PID
•
The result of queries
Figure 23 The result of select queries
P3. Implement a query language into the relation database
system
In this part, we will perform the insert, update and delete statements for each table
a. PRODUCT table:
•
Insert data queries
Queries:
insert into PRODUCT
values ('ip12prm', 'IPHONE12 PROMAX', '18000000', '7', 'SUP01'),
('ip14', 'IPHONE14', '20000000', '15', 'SUP02'),
('iP14pr', 'IPHONE14 PRO', '22000000', '10', 'SUP03'),
('ip14prm', 'IPHONE14 PROMAX', '27000000', '10', 'SUP04'),
('mba', 'MacbookAir', '30000000', '20', 'SUP05')
Result of insert data queries:
Figure 24 Result of insert data for product table
•
Update data Queries
Queries:
Update PRODUCT
Set Quantity = 5
where PID = 'ip12prm'
The result of queries: When updating, the data has been changed. Specifically, in the column ‘Quantity’ of ip12prm has gone from
‘7’to ‘5’
Figure 25 Result of update data for product table
•
Delete data Queries:
DELETE FROM PRODUCT
WHERE PID = ip12prm;
The result of Queries: when deletting, the data has been change. Specifically, in the row ‘ip12prm’ has been deleted
Figure 26 Result of delete data for product table
b. CUSTOMER table:
•
Insert data queries:
Queries:
insert into CUSTOMER
values ('KH01', 'Le Hoang', '0777415163', '23 Le Duan, Da Nang'),
('KH02', 'Le Van Nhan', '0905241148', '25 Ngo Quyen, Da Nang'),
('KH03', 'Phan Thi Thanh Hang', '0901951746', '52 Mac Thi Buoi, Da Nang'),
('KH04', 'Phan Thi Thanh Nga', '0586271152', '502 Nui Thanh, Da Nang'),
('KH05', 'Dang Ngoc Lien', '0906469129', '65 Hoang Van Thu, Da Nang')
The result of insert data queries:
Figure 27 Result of insert data for Customer table
•
Update data queries:
Queries:
Update CUSTOMER
set CustomerAdd = '55 Thai Thi Boi, Da Nang'
where CID = 'KH01'
The result of update data queries: : When updating, the data has been changed. Specifically, in the column the ‘CustomerAdd’ of
‘KH01’ has changed from ’23 Le Duan, Da Nang’ to‘55 Thai Thi Boi, Da Nang’
Figure 28 Result of update data for Customer table
Delete data queries: when deletting, the data has been delete. Specifically, in the row ‘KH05’ has been deleted
Figure 29 Result of delete data for Customer table
c. ORDERS table
•
Insert data queries
Queries:
insert into ORDERS
values ('O01', 'KH01', 'NV01', '2023-01-09'),
('O02', 'KH03', 'NV02', '2022-12-15'),
('O03', 'KH02', 'NV04', '2022-09-27'),
('O04', 'KH05', 'NV03', '2022-07-06'),
('O05', 'KH04', 'NV05', '2022-03-17')
The result of queries:
Figure 30 Result of insert data for Orders table
•
Update data queries
Queries:
Update ORDERS
set ORDERDATE = '2023-01-17'
where OID = 'O01'
The result of queries: When updating, the data has been changed. Specifically, in the column the ‘ORDERDATE’ of ‘O01’ has
changed from ’2023-01-09’ to‘2023-01-07’
Figure 31 Result of update data for Orders table
•
Delete data queries
Queries:
delete
from ORDERS
where OID = 'O05'
The result of queries: when deletting, the data has been delete. Specifically, in the row ‘O05’ has been deleted
Figure 32 Result of delete data for Orders table
d. STAFF table
•
Insert data queries:
Queries:
insert into STAFF
values
('NV01',
('NV02',
('NV03',
('NV04',
('NV05',
'Le Quoc Hung', '0765231542', '122 Nguyen Hoang, Da Nang', '7000000'),
'Nguyen Thanh Sang', '0905897141', '95 Bui Ta Han, Da Nang', '7000000'),
'Tran THi Thanh Tam', '0868235957', '15 Le Loi, Da Nang', '5000000'),
'Le Bao Quyen', '0901238147', '127/13 Nguyen Cong Tru, Da Nang', '10000000'),
'Nguyen Thanh Tung', '0926641148', '125 Nguyen Chi Thanh, Da Nang', '12000000')
The result of queries:
Figure 33 Result of insert data for Staff table
•
Update data queries
Queries:
update STAFF
set Salary = '7000000'
where StaffID = 'NV03'
The result of queries: When updating, the data has been changed. Specifically, in the column the ‘Salary’ of ‘NV03’ has changed
from ’5000000’ to‘7000000’
Figure 34 Result of update data for Staff table
•
Delete data queries:
Queries:
delete
from STAFF
where StaffID = 'NV05'
The result of queries: when deletting, the data has been delete. Specifically, in the row ‘NV05’ has been deleted
Figure 35 Result of delete data for Staff table
e. DETAILS table
•
Insert data queries
Queries:
insert into DETAILS
values
('O01', 'ip14', '4', '22000000'),
('O02', 'iP14pr', '3', '24000000'),
('O03', 'ip14prm', '4', '30000000'),
('O04', 'ip12prm', '7', '19000000'),
('O05', 'mba', '10', '32000000')
The result of queries:
Figure 36 Result of insert data for Details table
•
Update data queries:
Queries:
update DETAILS
set QUANTITY = '7'
where OID = 'O03'
The result of queries: When updating, the data has been changed. Specifically, in the column the ‘Quantity’ of ‘O03’ has changed
from ’4’ to‘7’
Figure 37 Result of update data for Details table
•
Delete data queries
Queries:
delete
from DETAILS
where OID = 'O05'
The result of queries: when deletting, the data has been delete. Specifically, in the row ‘O05’ has been deleted
Figure 38 Result of delete data for Details table
f. SUPLIERS table
•
Insert data queries:
Queries:
insert into SUPLIERS
values ('SUP01', 'FPT SHOP'),
('SUP02', ' THE GIOI DI DONG'),
('SUP03', ' XIAOMI'),
('SUP04', ' DIEN MAY XANH'),
('SUP05', ' VIETTEL STORE'),
('SUP06', ' HOANG HA MOBILE')
The result of queries:
Figure 39 Result of insert data for Supliers table
•
Update data queries:
Queries:
update SUPLIERS
set SupName = 'Ehub Store'
where SupID = 'SUP03'
The result of queries: When updating, the data has been changed. Specifically, in the column the ‘SupName’ of ‘O03’ has changed
from ’Xiaomi’ to‘Ehub Store’
Figure 40 Result of update data for Supliers table
•
Delete data queries
Queries:
delete
from SUPLIERS
where SupID = 'SUP06'
The result of queries: when deletting, the data has been delete. Specifically, in the row ‘SUP06’ has been deleted
Figure 41 Result of delete data for Supliers table
P4. Test the system against and test system requirements
1. Test case
In software engineering, a test case is a specification of the inputs, execution conditions, testing procedure, and expected results that
define a single test to be executed to achieve a particular software testing objective, such as to exercise a particular program path or to
verify compliance with a specific requirement.
A test case is usually a single step, or occasionally a sequence of steps, to test the correct behaviour/functionality, features of an
application. An expected result or expected outcome is usually given.
Below is the test case for my database:
Test
1
What is being
test
Check order
quantity
2
Check order
quantity
3
Check order
quantity
4
test salary
5
Test salary
How
Enter sample data
and evaluate the
results
Enter sample data
and evaluate the
results
Enter sample data
and evaluate the
results
Enter sample data
and evaluate the
results
Enter sample data
and evaluate the
results
Test data
used
-5
Expected Results
0
Zero count error
message
3
Success
0
Zero count error
message
-10
Negative salary
error message
Negative count
error message
2. Test log
A test log is a type of test artifact that is generated during test execution. It provides comprehensive information about each test run's
success to validate the quality, performance, and functionality of software applications.
The test log is one of the essential test artifacts created during the test execution. It contains a historical record of events related to
each test. Also, it provides information related to different test operations that include a source of issues and reasons for the failed
operation.
Below is the test log for my database:
Test
What is being
test
How
Test
data
used
Expected
result
Date
Acture result
Acti
on
take
n
Non
e
1
Check order
quantity
Enter
sample data
and evaluate
the results
-5
Negative count
error message
14/02/2023
2
Check order
quantity
Enter
sample data
and evaluate
the results
0
Zero count
error message
15/02/2023
Non
e
3
Check order
quantity
Enter
sample data
and evaluate
the results
3
Success
15/02/2023
Non
e
4
Test salary
Enter
sample data
and evaluate
the results
-10
Negative count
error message
20/02/2023
Non
e
5
Test salary
Enter
sample data
and evaluate
the results
0
Zero count
error message
20/02/2023
Non
e
P5. Produce technical and user documentation
To use the FPTshop application, you first need to search for it on Google and download it onto your device. Once downloaded, open
the application and choose from the three available options: customer, employee, or manager. If you're a customer, select that option
and either log in to your existing account or create a new one using your Gmail, Facebook, or phone number. If you're an employee or
manager, select the appropriate option and log in using your authorized account.
Once you've logged in, the interface will display different options depending on your role. Customers can search for products, make
purchases, check orders, and see which staff member is responsible for their order. Employees can enter product information, update
orders, and view customer information. Managers can see the number of products in stock, sales data, and employee work status.
It's important to enter all required data when using the application, and to avoid leaving any fields blank. Salary amounts must be
greater than zero, and codes for products, customers, employees, and orders can only be up to 10 characters long. Manufacturer codes
can be up to 50 characters, and names of customers, employees, products, and manufacturers can be up to 50 characters long. Phone
numbers cannot exceed 11 digits.
Download