You are on page 1of 48

lOMoARcPSD|35198367

Truong Duc Dung BH01128 Database Design And


Development ASM2 1st
nguyenquang vinh (Trường Cao đẳng Thực hành FPT)

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)
lOMoARcPSD|35198367

ASSIGNMENT 2

Qualification TEC Level 5 HND Diploma in Computing

Unit number and title Unit 04: Database Design & Development

Submission date 14/08/2023 Date Received 1st submission

Re-submission Date Date Received 2nd submission

Student Name Truong Duc Dung Student ID BH01128

Class IT0604 Assessor name Mr. Nguyen Thanh Trieu

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 Dung

Grading grid

P2 P3 P4 P5 M2 M3 M4 M5 D2 D3

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

❒ Summative Feedback: ❒ Resubmission Feedback:

Grade: Assessor Signature: Date:


Signature & Date:

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

Table of content
I. Introduction: ....................................................................................................................................................................................... 7
II. Body: ................................................................................................................................................................................................... 8
LO2 Develop a fully functional relational database system, based on an existing system design......................................................... 8
P2, P3 Develop the database system with evidence of user interface, output and data validations, and querying across multiple
tables. Implement a query language into the relational database system. ....................................................................................... 8
1. Introduction about program: ................................................................................................................................................ 8
2. Login function: ...................................................................................................................................................................... 9
a) User interface: ...................................................................................................................................................................... 9
b) Input, output data and vadation: ....................................................................................................................................... 10
c) Querry data: ........................................................................................................................................................................ 12
3. View function: ..................................................................................................................................................................... 12
a) User interface: .................................................................................................................................................................... 13
b) Input, output data: .............................................................................................................................................................. 14
c) Querry data: ........................................................................................................................................................................ 15
4. Add function: ...................................................................................................................................................................... 16
a) User interface: .................................................................................................................................................................... 16
b) Input, output data and vadation: ....................................................................................................................................... 18
c) Querry data: ........................................................................................................................................................................ 21
5. Edit function:....................................................................................................................................................................... 22
a) User interface: .................................................................................................................................................................... 22
b) Input, output data and vadation: ....................................................................................................................................... 23

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

c) Querry data: ........................................................................................................................................................................ 26


6. Delete function: .................................................................................................................................................................. 27
a) User interface: .................................................................................................................................................................... 27
b) Input, output data and vadation: ....................................................................................................................................... 28
c) Querry data: ........................................................................................................................................................................ 29
7. Logout function ................................................................................................................................................................... 30
a) User interface: .................................................................................................................................................................... 30
b) Querry data ......................................................................................................................................................................... 32
LO3 Test the system against user and system requirements. .............................................................................................................. 33
P4 Test the system against user and system requirements. ............................................................................................................ 33
1) Test plan .............................................................................................................................................................................. 33
2) Test case.............................................................................................................................................................................. 34
LO4 Produce technical and user documentation. ................................................................................................................................ 39
P5 Produce technical and user documentation................................................................................................................................ 39
III. Conclusion: ........................................................................................................................................................................................ 46
IV. References: ....................................................................................................................................................................................... 47

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

List of pictures
Picture 1 Login display ............................................................................................................................................................................... 9
Picture 2 data in "users" table ................................................................................................................................................................... 9
Picture 3 User enter correct username and password ........................................................................................................................... 10
Picture 4 Notice when don't enter username or password ................................................................................................................... 10
Picture 5 enter wrong username or password ........................................................................................................................................ 11
Picture 6 Notice when enter wrong username or password .................................................................................................................. 11
Picture 7 Home display ............................................................................................................................................................................ 13
Picture 8 Grade display ............................................................................................................................................................................ 14
Picture 9 add function button.................................................................................................................................................................. 16
Picture 10 add display .............................................................................................................................................................................. 17
Picture 11 Example for add function (1) .................................................................................................................................................. 18
Picture 12 Example for add function (2).................................................................................................................................................. 19
Picture 13 users don't enter information to add display ........................................................................................................................ 20
Picture 14 Edit button .............................................................................................................................................................................. 22
Picture 15 Edit display .............................................................................................................................................................................. 23
Picture 16 After edited ............................................................................................................................................................................. 24
Picture 17 don't enter data to edit .......................................................................................................................................................... 25
Picture 18 Delete button .......................................................................................................................................................................... 27
Picture 19 delete function........................................................................................................................................................................ 28
Picture 20 sign out button ....................................................................................................................................................................... 30
Picture 21 After sign out .......................................................................................................................................................................... 31
Picture 22 Step 1....................................................................................................................................................................................... 39
Picture 23 Step 2....................................................................................................................................................................................... 40
Picture 24 Step 3....................................................................................................................................................................................... 41
Picture 25 Step 4....................................................................................................................................................................................... 42
Picture 26 Step 5....................................................................................................................................................................................... 43

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

Picture 27 Step 6....................................................................................................................................................................................... 44


Picture 28 Step 7....................................................................................................................................................................................... 45

List of tables
Table 1 Test plan ...................................................................................................................................................................................... 33
Table 2 Test case ...................................................................................................................................................................................... 38

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

I. Introduction:
After completing the database report in asm1 here is the next part. The purpose of this report is to document the development and
testing of a database system for a company that requires a solution to manage its data and produce management information. The
report will cover the following aspects of the project. Design of the database system, including the user interface, output, data
validation, and querying across multiple tables. The implementation of the database system, including the use of a query language,
system security, and database maintenance features. The demonstration of the database system to the manager, showing how it
meets the user and system requirements. The testing of the database system, using appropriate test data and methods, and
evaluating the effectiveness of the testing. The production of technical and user documentation, including graphical representations
and flowcharts, to explain how the system works and how to use it. Report will also include an assessment of whether meaningful
data has been extracted through the use of query tools, an evaluation of the effectiveness of the database solution, and suggestions
for improvements. The report will be based on the evidence gathered during the development and testing phases, as well as
feedback from the manager and users. The report will aim to demonstrate that the database system is a fully functional and reliable
solution that meets the needs of the company.

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

II. Body:
LO2 Develop a fully functional relational database system, based on an existing system
design.
P2, P3 Develop the database system with evidence of user interface, output and data validations, and querying
across multiple tables. Implement a query language into the relational database system.

1. Introduction about program:


My program is created by Visual Studio Code software.

The application helps us to login, view, add, edit and delete graded score information.

The data information in the application is taken from the data table created in asm1.

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

2. Login function:
This function will help user can login to this program with username and password from data in “users” table

a) User interface:
This is login interface that users can enter username and password to login

Picture 1 Login display

Picture 2 data in "users" table

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

b) Input, output data and validation:

Picture 3 User enter correct username and password

if the user does not enter a username or password, there will be a message "username or password empty!"

Picture 4 Notice when don't enter username or password

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

If users enter wrong a username or password, there will be a message "Account invalid!"

Picture 5 enter wrong username or password

Picture 6 Notice when enter wrong username or password

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

c) Querry data:
Code for login function: This is the SQL query for the login function

1. function checkLogin($username, $password)


2. {
3. //Kiem tra dang nhap
4. // tai khoan co ton tai trong database ko?
5. $db = connection(); //goi bien ket noi toi database
6. //viet cau lenh sql truy van
7. $sql = "SELECT * FROM `nguoi_dung`WHERE `username` = :account AND
`password` = :pass LIMIT 1 ";
8. //:account va :pass chinh la khai bao 1 bien truyen cau lenh sql
9. //:account va :pass la 2 bien dai dien cho 2 tham so $username, $password
10. $stmt = $db->prepare($sql);
11. $data = []; // du lieu cua cau lenh sql se dc gan vao day
12. if($stmt){
13. //Thuc thi khi khong co loi cu phap
14. //Kiem tra tham so truyen vao cau lenh sql
15. $stmt->bindParam(":account", $username, PDO::PARAM_STR);
16. $stmt->bindParam(":pass", $password, PDO::PARAM_STR);
17. //Chay cau lenh
18. if($stmt->execute()){
19. // Kiem tra cau lenh slect sql co du lieu tra ve ko
20. if($stmt->rowCount()>0){
21. $data = $stmt->fetch(PDO::FETCH_ASSOC);
22. }
23. }
24. }
25. disconnection($db);
26. return $data;
27. }

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

3. View function:

a) User interface:
That interface will help user can see program and information this program.

Picture 7 Home display

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

b) Input, output data:


You can see all items in this display and I will example for items “Grade”

Picture 8 Grade display

After press in Grade this display will appear and you can see all information of Grade table.

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

c) Querry data:
This is the SQL query for the view function

function getListFaculty(){
// lay all du lieu tu database
$data = [];
$db = connection();
$sql = "SELECT * FROM `khoa` GROUP BY `id` DESC";
$stmt = $db->prepare($sql);
if($stmt){
if($stmt->execute()){
if($stmt->rowCount() > 0){
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
}
}
}
disconnection($db);
return $data;
}

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

4. Add function:

a) User interface:
This interface have necessary function help user can add more information to the table, you can press add button to add
more information to the table.

Picture 9 add function button

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

After press this button, add display will appear and you can add information to each row. With each row have another
information in this table.

Picture 10 add display

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

b) Input, output data and validation:

Picture 11 Example for add function (1)

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

After fill all information and press add button

Picture 12 Example for add function (2)

So information you fill will appear in this table and notice” Thao tac thanh cong” will appear.

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

If users don’t enter information to add display, there will be messaged notice

Picture 13 users don't enter information to add display

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

c) Querry data:
Code for this function: This is the SQL query for the add function

function insertFaculty($dataInsert = []){


$code = $dataInsert['code'];
$name = $dataInsert['name'];
$leader = $dataInsert['mark'];
$openDate = $dataInsert['mark_day'];
$status = $dataInsert['status'];
$createdTime = date("Y-m-d H:i:s");

$db = connection();
$sql = "INSERT INTO
`khoa`(`extra_id`, `name`, `mark`, `mark_day`, `status`,
`created_at`) VALUES(:code, :nameFaculty, :mark, :markday, :statusFaculty,
:createTime)";
$stmt = $db->prepare($sql);
$checkInsert = false;
if($stmt){
$stmt->bindParam(":code", $code, PDO::PARAM_STR);
$stmt->bindParam(":nameFaculty", $name, PDO::PARAM_STR);
$stmt->bindParam(":mark", $leader, PDO::PARAM_STR);
$stmt->bindParam(":markday", $openDate, PDO::PARAM_STR);
$stmt->bindParam(":statusFaculty", $status, PDO::PARAM_INT);
$stmt->bindParam(":createTime", $createdTime, PDO::PARAM_STR);
if($stmt->execute()){
$checkInsert = true;
}
}
disconnection($db); // ngat ket noi
return $checkInsert;
// ham nay tra ve true insert thanh cong
}

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

5. Edit function:

a) User interface:
This interface that will help user can repair wrong information. You can see edit button next information.

Picture 14 Edit button

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

b) Input, output data and validation:


After you press edit button edit display will appear with all information in this row.

Picture 15 Edit display

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

You can save after you edit by update button under this table. And will return to Grade display with information edited.

Picture 16 After edited

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

If you don’t enter data to this form will appear notice for each data in each row.

Picture 17 don't enter data to edit

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

c) Querry data:
Code for this function: This is the SQL query for the edit function

function updateFacultyById($dataUpdate, $id){


$code = $dataUpdate['code'];
$name = $dataUpdate['name'];
$leader = $dataUpdate['mark'];
$open_date = $dataUpdate['mark_day'];
$status = $dataUpdate['status'];
$updateTime = date("Y-m-d H:i:s");
$checkUpdate = false;
$sql = "UPDATE `khoa` SET `extra_id`
= :extra_id, `name` = :nameFaculty, `mark`=
:mark, `mark_day` = :markday, `status`= :statusFaculty, `updated_at`= :updated_at
WHERE `id` = :id";
$db = connection();
$stmt = $db->prepare($sql);
if($stmt){
$stmt->bindParam(":extra_id", $code,PDO::PARAM_STR);
$stmt->bindParam(":nameFaculty", $name,PDO::PARAM_STR);
$stmt->bindParam(":mark", $leader,PDO::PARAM_STR);
$stmt->bindParam(":markday", $open_date,PDO::PARAM_STR);
$stmt->bindParam(":statusFaculty", $status,PDO::PARAM_STR);
$stmt->bindParam(":updated_at", $updateTime,PDO::PARAM_STR);
$stmt->bindParam(":id", $id,PDO::PARAM_STR);
if($stmt->execute()){
$checkUpdate = true;
}
}
disconnection($db);
return $checkUpdate;
}

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

6. Delete function:

a) User interface:
That interface will help users can delete wrong information or not required information. Next edit button is delete button

Picture 18 Delete button

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

b) Input, output data and validation:


After delete this button information in this table will deleted and appear notice “Thao tac thanh cong”.

Picture 19 delete function

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

c) Querry data:
Code for this function This is the SQL query for the delete function

function deleteFaculty($id = 0){


$db = connection();
$checkDelete = false;
$sql = "DELETE FROM `khoa` WHERE `id` = :id ";
$stmt = $db->prepare($sql);
if($stmt){
$stmt->bindParam(":id", $id, PDO::PARAM_INT);
if($stmt->execute()){
$checkDelete = true;
}
}
disconnection($db);
return $checkDelete;
}

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

7. Logout function

a) User interface:
This interface help users quit this program. You can sign out this program by press arrow next to the words “Hello, admin”

Picture 20 sign out button

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

After press sign out you will redirect to login page

Picture 21 After sign out

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

b) Querry data
Code for this function: This is the SQL query for the logout function

<?php
session_start();

function logout(){
if(isset($_POST['btnLogout'])){
session_destroy(); //huy tat ca session
header("Location:login.php");
exit();
}
}
logout();

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

LO3 Test the system against user and system requirements.


P4 Test the system against user and system requirements.

1) Test plan
In this test plan I will test five functions: Login, Add, Edit, Delete, Log out. I will check all function worked or not.

Test Scenarios Purpose Expected results

1 Login function Check Login function can work by get data from Users can login this application
database

2 Add function Check Add function can work and add data to Users can add data to the table and data add to
the table in database database
3 Edit function Check Edit function can work and edit data on Users can edit data in the table and data edited
the table in database in database
4 Delete function Check Delete function can work and delete data Users can delete data in the table and data
on the table in database deleted in database
5 Log out function Check Log out function can work Users can logout this application

Table 1 Test plan

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

2) Test case

Test Function Cases Result

1 Login Login function can work by get Successful, Users can login to this application
function data from database

2 Login If users don’t enter username or Fail, there will be a message "username or password empty!"
function password

3 Login If users enter wrong username or Fail, there will be a message "Account invalid!"
function password

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

4 Add Add function can work and add Successful, Users can add to this table
function data to the table in database

5 Add If users don’t fill data in add Fail, Notice will appear
function display

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

6 Edit Edit function can work and edit Successful


function data on the table in database

7 Edit If users don’t enter to edit Fail, Notice will appear


function

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

8 Delete Delete function can work and


function delete data on the table in Successful, Users can delete data in the table
database

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

9 Log out Log out function can work


function Successful, Users will redirect to login page

Table 2 Test case

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

LO4 Produce technical and user documentation.


P5 Produce technical and user documentation.
Step 1: login to the application need to login with username and password

Picture 22 Step 1

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

Step 2: After login the application success will display a screen displaying Grade, Course, Classroom, Subject, Majors, Division,
Student information.

Picture 23 Step 2

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

Step 3: Users can click to each items to interact information each table.

Picture 24 Step 3

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

Step 4: Users can use add button to add data to table

Picture 25 Step 4

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

Step 5: Users can use edit button to edit data in database

Picture 26 Step 5

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

Step 6: Users can use delete button to delete data in table

Picture 27 Step 6

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

Step 7: Users can use sign out button to exit this application

Picture 28 Step 7

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

III. Conclusion:
In this project, I have designed and developed a database system for a company that requires a solution to manage their data
and produce management information. I have followed the user and system requirements given by my manager, and used
evidence of user interface, output, data validation, and querying across multiple tables to create a fully functional database
system. I have also implemented a query language into the relational database system, which allows the user to perform
complex queries and extract meaningful data. I have demonstrated the developed system to my manager, and received feedback
on its performance and functionality. I have assessed whether meaningful data has been extracted through the use of query
tools, and produced appropriate management information for the company. I have evaluated the effectiveness of the database
solution in relation to user and system requirements, and suggested improvements for future development. I have also tested
the system using various test data, and documented the results and outcomes. My manager has completed a witness statement
indicating how my tests are performing against user and system requirements. I have produced a brief report assessing the
effectiveness of the testing, and explained the choice of test data used. Lastly, I have produced technical and user
documentation for the fully functional database system, which includes diagrams showing movement of data through the
system, and flowcharts describing how the system works. I have also provided instructions on how to use the system, its
features, security, and maintenance. The technical and user documentation will be given to the company for their reference and
guidance. In conclusion, I have successfully completed the project objectives and delivered a database solution that meets the
needs of the company. I have demonstrated my skills and knowledge in designing, developing, testing, and documenting a
database system using various tools and techniques. I have also learned from this project experience, and reflected on my
strengths and weaknesses as a database developer. I hope that my work will be useful and beneficial for the company.

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)


lOMoARcPSD|35198367

IV. References:
Simbla | How to Create a Web Database Application? [online]. Available at:

https://www.simbla.com/post/how-to-create-a-web-database-application

Shreya Bose, December 20, 2022| What is a Test Plan? [online]. Available at:

https://www.browserstack.com/guide/test-planning

Microsoft, 03/21/2023 | Use Visual Studio Code to connect and query. [article]. Available at:

https://learn.microsoft.com/en-us/azure/azure-sql/database/connect-query-vscode?view=azuresql

Downloaded by Nguy?n ??c Ng?c (chibingockawaii@gmail.com)

You might also like