Professional Documents
Culture Documents
ASSIGNMENT 2
Unit number and title Unit 04: Database Design & Development
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.
Grading grid
P2 P3 P4 P5 M2 M3 M4 M5 D2 D3
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
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
List of tables
Table 1 Test plan ...................................................................................................................................................................................... 33
Table 2 Test case ...................................................................................................................................................................................... 38
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.
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.
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.
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
if the user does not enter a username or password, there will be a message "username or password empty!"
If users enter wrong a username or password, there will be a message "Account invalid!"
c) Querry data:
Code for login function: This is the SQL query for the login function
3. View function:
a) User interface:
That interface will help user can see program and information this program.
After press in Grade this display will appear and you can see all information of Grade table.
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;
}
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.
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.
So information you fill will appear in this table and notice” Thao tac thanh cong” will appear.
If users don’t enter information to add display, there will be messaged notice
c) Querry data:
Code for this function: This is the SQL query for the add function
$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
}
5. Edit function:
a) User interface:
This interface that will help user can repair wrong information. You can see edit button next information.
You can save after you edit by update button under this table. And will return to Grade display with information edited.
If you don’t enter data to this form will appear notice for each data in each row.
c) Querry data:
Code for this function: This is the SQL query for the edit function
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
c) Querry data:
Code for this function This is the SQL query for the delete function
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”
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();
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.
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
2) Test case
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
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
Picture 22 Step 1
Step 2: After login the application success will display a screen displaying Grade, Course, Classroom, Subject, Majors, Division,
Student information.
Picture 23 Step 2
Step 3: Users can click to each items to interact information each table.
Picture 24 Step 3
Picture 25 Step 4
Picture 26 Step 5
Picture 27 Step 6
Step 7: Users can use sign out button to exit this application
Picture 28 Step 7
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.
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