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
Student ID
Class
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
P2
P3
P4
P5
M2
M3
M4
M5
D2
D3
Resubmission Feedback:
Summative Feedback:
2.1
Grade:
Signature & Date:
Assessor Signature:
Date:
Table of Contents
Introduction.......................................................................................................................................................................... 1
1. Develop the database system...................................................................................................................................... 1
1.1 Final Mock-up of the application.......................................................................................................................... 1
1.2. Queries to create database with results............................................................................................................ 7
1.3. Data in database system...................................................................................................................................... 12
1.4. Security.................................................................................................................................................................... 14
2. Produce queries............................................................................................................................................................ 16
2.1. Insert into, delete, update................................................................................................................................... 16
2.2. Select........................................................................................................................................................................ 18
2.3. Advanced query..................................................................................................................................................... 19
2.4. Evaluate the effectiveness of the database solution.................................................................................... 24
3. Test the system.............................................................................................................................................................. 24
3.1. Test case.................................................................................................................................................................. 24
3.2. Flowchart to show how the system works...................................................................................................... 25
Conclusion........................................................................................................................................................................... 32
Introduction
In this assignment, a database of online library system has been deployed on SQL server
based on query language. This database provides, allows editing, deleting, and inserting
necessary information to maintain the library such as personal information of members,
staff, login, book information, loan vouchers. It is also designed with statistics to help
administrators easily manage and know the status of the library. Here, a complete mock-up
along with a relational database has also been designed and displayed. Testing is also
conducted to fix bugs. Finally, a technical document was developed to guide users in using
this system based on the mock-up.
1. Develop the database system
1.1 Final Mock-up of the application
Based on the old mock-up designs in the previous assignment, a full blueprint of the system was
built. This update provides new functions for querying statistics for library management.
Figure 1: Login interface
1
Figure 2: Main interface for staf
Figure 3: Information of staf
2
Figure 4: CRUD (Create/Read/Update/Delete) information of book (part 1)
Figure 5: CRUD information of book (part 2)
3
Figure 6: View information of readers
Figure 7: CRUD borrowing
4
Figure 8: Borrow Detail
Figure 9: Return Book
5
Figure 10: Statistic activity
Figure 11: Main interface for reader
6
Figure 12: Information of reader
1.2. Queries to create database with results
Based on the designs approved by the CEO, a database system will be generated by the
query that creates the table. They will be displayed with the results once run.
Figure 13: Query to create database ASM and table Member
7
To build a database system, a database must be created in SQL Server, ASM is the database
created and used to store this library system. The tables will be created by the queries so
that the field names, data types, data validation are designed.
Figure 14: Table Member
Figure 15: Query to create table Staf, Login and Author
Figure: Table Staf
8
Figure 16: Table Login
Figure 17: Table Author
Figure 18: Query to create table Book and Borrow
9
Figure 19: Table Book
Figure 20: Table Borrow
Figure 21: Query to create table BorrowDetail and ReturnBook
10
Figure 22: Table BorrowDetail
Figure 23: Table ReturnBook
Figure 24: Final diagram
11
1.3. Data in database system
The system will import the existing data, because the new system is built and the amount of
data is large, the data will be imported through the built-in tool on the SQL Server system,
so these input data will not be available. using query language.
Figure 25: Table Login
Figure 26: Table Borrow
Figure 27: Table Member
12
Figure 28: Table Author
Figure 29: Table Staf
Figure 30: Table Book
Figure 31: Table ReturnBook
Figure 32: Table BorrowDetail
13
1.4. Security
Figure 33: Query to create role Staf to login
Figure 34: Query to create role Member
14
For login, 2 permissions are set as Staff and Member roles. For staff, grant select, update,
delete, alter permissions for all tables, in the permission there are 2 accounts of staff.
For the Member role, grant update permission in the members table for accounts that have
this permission.
These two images are the login screen, the login
account has the role of Member, so it only has
permissions in the member table.
15
2. Produce queries
2.1. Insert into, delete, update
Users can manipulate operations such as insert, delete, update on the database. With
Insert, user uses Insert into to add data to the Borrow and BorrowDetail tables.
Figure 33: Query to insert
Figure 35: Result at Borrow
Figure 36: Result at BorrowDetail
16
A title is deleted at Book and result
Figure 37: Query to delete
Figure 38: Result at Book
With update, the record in the Author table with ID = 126 will be edited Lastname and the
result.
Figure 39: Query to update
Figure 40: Result at Author
17
2.2. Select
Figure 41: Query to select Students' borrowing times and result
Figure 42: Query to select Borrowed book rating and result
Figure 43: Published 2010 to present and result
18
Figure 44: Query to select number of times staf lent books and result
2.3. Advanced query
Figure 45: Query to create procedure Check_borrow_activity and result
19
Figure 46: Query to create procedure CheckOperation
20
Figure 47: Query to create procedure All_Borrow
21
Figure 48: Query to create procedure check status and cost in Borrow and result
22