You are on page 1of 50

ASSIGNMENT 2 FRONT SHEET

Qualification TEC Level 5 HND Diploma in Computing

Unit number and title Unit 04: Database Design & Development

Submission date 07/05/2019 DateReceived1stsubmission

Re-submissionDate DateReceived2ndsubmission

Student Name Vu Hoang Ha Student ID GCH18843

Class GCH0710 Assessor name Vuong Thi Nhung

Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.

Student’s signature

Grading grid

P1 M1 D1
I, II, III, IV V

1
Summative Feedback:ResubmissionFeedback:

Grade: AssessorSignature: Date:


InternalVerifier’sComments:

Signature&Date:

2
Table of Contents
Table of Figure .............................................................................................................................................. 4
Introduction .................................................................................................................................................. 5
I. User Interfaces ...................................................................................................................................... 6
1. Input Interfaces ................................................................................................................................. 6
2. Output Interfaces ............................................................................................................................ 12
Member User Interfaces ..................................................................................................................... 12
Librarian User Interfaces ..................................................................................................................... 18
II. Database System ................................................................................................................................. 27
1. Data Sample .................................................................................................................................... 27
2. Testing ............................................................................................................................................. 28
3. Maintaining ..................................................................................................................................... 30
III. Technical Document ....................................................................................................................... 32
Introduction ............................................................................................................................................ 32
1. Logical Design.................................................................................................................................. 32
2. Physical Design ................................................................................................................................ 33
3. User Case Scenario .......................................................................................................................... 35
IV. User Document ............................................................................................................................... 36
Login System Guideline ....................................................................................................................... 36
Member Guideline .............................................................................................................................. 38
Library Guideline ................................................................................................................................. 41
V. Evaluate............................................................................................................................................... 48
References .................................................................................................................................................. 50

3
Table of Figure
Figure 1. Login page.......................................................................................................................................................6

Figure 2. Login form ......................................................................................................................................................7

Figure 3. Edit Account page ...........................................................................................................................................8

Figure 4. Header Book Manage page ............................................................................................................................9

Figure 5. Add a new book form .....................................................................................................................................9

Figure 6. Edit a book form ...........................................................................................................................................11

Figure 7. Home page ...................................................................................................................................................12

Figure 8. Search Result page .......................................................................................................................................14

Figure 9. Message box .................................................................................................................................................14

Figure 10. Book Detail page .........................................................................................................................................16

Figure 11. Member Account page (infor tab) ..............................................................................................................17

Figure 12. Member Account Page (List Books Loan tab) .............................................................................................18

Figure 13. Book Manage Page (List Books tab) ...........................................................................................................19

Figure 14. Book Manage Page (Book Out on Loan tab)...............................................................................................20

Figure 15. Rule Manage Page ......................................................................................................................................22

Figure 16. Member Manage Page (Overdue Fine tab) ................................................................................................23

Figure 17. User Manage Page (Loan Books tab) ..........................................................................................................24

Figure 18. Books Returned form .................................................................................................................................25

4
Introduction
With a rapid increase in the number of students, FPT University decided to develop a system to
manage the library easier, called ‘Online Library System’. Using this system, students, the faculty of the
university (member) can find and check the available books online, request to borrow a book by a few
clicks and pick at the library when it is convenient for them. With the online request, the librarian will take
the correct book and give to member when all information is automatically updated in the system. Any
wrong information about book ID or student ID will not lead to a successful request. Also, the borrowing
of the book is managed by computer system, which can automatically send an email to the student
account, reminding them of the return date. Book catalog is also updated, with exact details about
availability, quantity, edition, etc.

The report represents the input, output interfaces of the Online Library System and the SQL queries
for the functions add, display, edit and delete data. In addition, a simple test logs will be built to check the
queries to ensure that the data are correct or not. Finally, a technical document, which includes the logical
and physical design, a user document will be showed in the end of the report.

5
I. User Interfaces
The Online Library System (OLS) includes the function of providing different services for students, the
faculty of the university and the library staff. These groups of users (Member/Librarian) will have different
access to the system, which is basically defined by their role, email and password (higher security). Each
of them is provided a google email to sign in the OLS, while Member and Librarian have different user
interfaces.

1. Input Interfaces
The input interfaces of the OLS include Log in form, Edit data form and Add data form. When users

access to the OLS website, the Log in Screen is displayed, they will see a button under
‘Login by using your account on’ title on the right side of this page.

Figure 1. Login page

After clicking on the button, users are redirected to Google login form, where they will enter their
email and password. If the email and password are correct, users will login successfully to the OLS.

6
Figure 2. Login form

When the login process is complete, users will see an avatar account (1) display on the header of
home page. (1)

To see and check the information of personal account, users click to the avatar, an account page will
be showed, which includes a ‘Edit account’ button (3) in the right side. Because every account is created
and managed by administrator, users only change the information in the Contact and Other section by
clicking on ‘Edit account’ button (2). Then users can rewrite texts of the sections (Contact, Other) to
change the information.

7
(2)

(3)

Save

Figure 3. Edit Account page

When users finished edit their account, click to ‘Save’ button (3) on bottom left side of the page to
save new information.

The SQL query of Edit an account function is:


CREATE PROC EditAccount
@Mobile VARCHAR(11), @Address VARCHAR(100), @Skype VARCHAR(50), @Language VARCHAR(100),
@Skill VARCHAR(100), @Habit VARCHAR(100), @UserID VARCHAR(7)
AS
UPDATE Users SET Phone = @Mobile, Address = @Address WHERE UserID = @UserID;

Add new book (rule) and Edit current book(rule) functions are only for librarians, who manage the
OLS data. To add a new book (or a new rule), the librarians click to ‘Add new book’ button (4) (or ‘Add
new rule’ button) on the right side of Book Manage page (Rule Manage page).

8
Books Members Rules

(4)

Figure 4. Header Book Manage page

Add a new book form display after the librarians click on ‘Add new book’ button (4). In this form, the
librarians fill the information of a new book, and click on ‘Save Book’ button to save the data. In addition,
users click on ‘Cancel’ button to close the form and ‘Reset’ button to clear texts in all text boxes.

Figure 5. Add a new book form

These SQL queries of Add a new book and Add a new author are showed below:

9
➢ Adding a new book
CREATE PROC AddBook
@Title VARCHAR(50), @Detail VARCHAR(200),
@DateOP VARCHAR(15), @Publisher VARCHAR(100),
@Qty INT, @Image, @CategoryID VARCHAR(7), @LocationID INT, @Author VARCHAR(100)
AS
BEGIN
DECLARE @BookID INT
IF NOT EXISTS ( SELECT * FROM Book
WHERE Title = @Title
AND DateOfPublication = @DateOP)
INSERT INTO
Book(Title,Description,DateOfPublication,Publisher,Quantity,Image,CategoryID,LocationI
D)
VALUES(@Title,@Detail,@DateOP,@Publisher,@Qty,@Image,@CategoryID,@LocationID)
SET @BookID = (SELECT BookID FROM Book WHERE Title = @Title)
INSERT INTO Author VALUES(@BookID, @Author)
END

On ‘Books Manage’ page, each book has an edit button (5) to help the librarians change the data
of the book.

(5)

When the librarians click on the button, an Edit book form will display includes the current
information. After changing the data, the librarians click on button ‘Save’ to save new data of the book or
click on ‘Cancel’ button to close the form.

10
Figure 6. Edit a book form

To update the data of a book, an ‘EditBook’ procedure is created as follows:


CREATE PROC EditBook
@BookID,
@Title VARCHAR(50), @Detail VARCHAR(200),
@DateOP VARCHAR(15), @Publisher VARCHAR(100),
@Qty INT, @Image IMAGE,
@CategoryID VARCHAR(7), @LocationID INT, @Author VARCHAR(100)
AS
UPDATE Book SET Title = @Title, Description = @Detail, DateOfPublication = @DateOP,
Publisher = @Publisher, Quantity = @Qty, Image = @Image,
CategoryID = @CategoryID, LocationID = @LocationID WHERE BookID = @BookID;
UPDATE Auhthor SET AuthorName = @Author WHERE BookID = @BookID;

11
2. Output Interfaces
Member User Interfaces
The Output Interfaces of Member include Home page, Search Book Results page, Book Detail Page
and User Account page, which will be showed below.

Home page has a searching tool, list new update books, library opening hours and library contact.
Meanwhile, the searching tool helps members to find books quickly and easily. The members fill the book
title in text box and click on ‘Search’ button, then the next page will show books have the same title. If the
members enter a title that they only remembered but it is not entirely correct, the search results page
will display a list of books, which have the titles match the letters be entered. The searching tool has three
options: A – Z Database (search a book by checking the similarity between the entered letters in the text
box and the book’s title in database), Author (search by checking the similarity between the entered
letters in the text box and author’s name in database and display list books of the author) and Category
(search by checking the similarity between the entered letters in the text box and category’s name in
database and display list books of the category).

(5)

Figure 7. Home page

12
Similar to the functions of Home page mentioned above, a view displays the location operation
hours and three procedures of searching book tool are created as follows

➢ Displaying location operation hour (5)


CREATE VIEW LocationTime AS
SELECT Name, OperationHour FROM Location;

➢ Searching a book by title


CREATE PROC BookName
@Title VARCHAR(50)
AS
SELECT B.Title, A.AuthorName, B.Publisher, B.DateOfPublication FROM Book B
JOIN Author A ON A.BookID = B.BookID
WHERE B.Title = @Title OR B.Title like @Title + '%'

➢ Searching a book by author


CREATE PROC AuthorName
@Author VARCHAR(50)
AS
SELECT B.Title, A.AuthorName, B.Publisher, B.DateOfPublication FROM Book B
JOIN Author A ON A.BookID = B.BookID
WHERE A.Name = @Author OR A.Name like @Author + '%'

➢ Searching a book by category name


CREATE PROC CategoryName
@Category VARCHAR(30)
AS
SELECT B.Title, B.Publisher, B.DateOfPublication, C.Name FROM Book B
INNER JOIN Category C ON B.CategoryID = C.CategoryID
WHERE C.Name = @Category OR C.Name like @Category + '%'

On ‘Search Results’ page, the list books have the same title with the entered letter are displayed. The
members also see ‘Borrow’ button and ‘Read more’ button in the right side of each book. However, if the
‘Borrow’ button color is gray, this book is not available (the book’s quantity is 0), the members cannot
borrow it.

13
Figure 8. Search Result page

If the members want to borrow a book, they click the ‘Borrow’ button, then a book borrowed request
will be made and a messenger box, which has the information of this book, date issue and date due to
return, will be showed.

(6)

Figure 9. Message box

The data show on the message box are the title and author’s name of the book that member selected,
date issue and date due for return. When the members click on ‘OK’ button (6), they complete the loan
book request. To show the data on message box and save the data of book out on loan, two procedures
are created as follows:

14
➢ Showing messenger box
CREATE PROC MessageBox
@BookID INT
AS
BEGIN
DECLARE @Title VARCHAR(50), @Author VARCHAR(50), @DateI DATETIME, @DateR DATETIME
SELECT @Title = B.Title, @Author = A.AuthorName from Author A
JOIN Book B ON A.BookID = B.BookID
WHERE A.BookID = @BookID
SELECT @DateI = GETDATE(), @DateR = DATEADD(day, 7, @DateI)
PRINT 'You have borrowed ' + @Title + ' ' + @Author + '
' +
'Date Issue: ' + CAST(@DateI as varchar) + ' ' + 'Date due for return: ' + CAST(@DateR
as varchar) ;
END

➢ Save the book borrowed (6)


CREATE PROC BookBorrowed
@UserID VARCHAR(7), @BookID INT
AS
DECLARE @DateI DATETIME, @DateR DATETIME
SELECT @DateI = GETDATE(), @DateR = DATEADD(day, 7, @DateI)
INSERT INTO BookOutOnLoan(UserID,BookID,DateIssue,DateDueForReturn,Status)
VALUES (@UserID,@BookID,CAST(@DateI AS DATE),CAST(@DateR AS DATE),'Not returned');

Additionally, the members click the ‘Read more’ button if they want to see more details of a book
before decide to borrow, a description of the book will be displayed on ‘Book Details’ page. On the page,
the members also see the location of the book, where they can find by themselves if they only want to
read it. The query to display these data is showed below.

15
Location A

Borrow

Figure 10. Book Detail page

➢ Displaying a book detail


CREATE PROC BookDetail
@BookID INT
AS
SELECT B.Title, A.AuthorName, B.Publisher, B.DateOfPublication, L.Name FROM Book B
JOIN Author A ON A.BookID = B.BookID
JOIN Location L ON L.LocationID = B.LocationID
WHERE B.BookID = @BookID

‘Member Account’ page shows the member information such as name, date of birth, phone number,
etc. Moreover, the page also has ‘List book loan’ tab (displays list books that the members borrowed) and
‘Notify’ tab (shows notify messages or emails that the OLS system sends to members, if the members
violate the library rules). On ‘List loan book’ tab, the members can edit and see their information, total
books that they have borrowed and total books that they have returned. All of the data are displayed by
creating four procedures ‘Infor’, ‘UserBorrowed’, ‘UserReturn’ and ‘Listloanbook’.

16
(7)

(8)

Infor List books loan Notify

Figure 11. Member Account page (Infor tab)

➢ Displaying information tab


CREATE PROC Infor
@UserID VARCHAR(7)
AS
SELECT * FROM Users WHERE UserID = @UserID

➢ Displaying total book borrowed (7)


CREATE PROC UserBorrowed
@UserID VARCHAR(7)
AS
SELECT COUNT(DISTINCT BookBorrowingID) FROM BookOutOnLoan
GROUP BY UserID, DateIssue, DateDueForReturn
HAVING UserID = @UserID AND Status = 'Not returned'

➢ Displaying total book returned (8)


CREATE PROC UserReturned
@UserID VARCHAR(7)
AS

17
SELECT COUNT(DISTINCT BookBorrowingID) FROM BookOutOnLoan
GROUP BY UserID, DateIssue, DateDueForReturn
HAVING UserID = @UserID AND Status = 'Returned'

Figure 12. Member Account Page (List Books Loan tab)

➢ Displaying list books loan tab


CREATE PROC ListLoanBook
@UserID VARCHAR(7)
AS
SELECT BookID, DateIssue, DateDueForReturn, Status FROM BookOutOnLoan B
WHERE B.UserID = @UserID AND Status = 'Not returned'

Librarian User Interfaces


The Output Interfaces of Librarian include ‘Books Manage’ page, ‘Members Manage’ page and ‘Rules
Manage’ page, which are very useful for the librarians to manage data. After login to the OLS, the librarians
see ‘Book Manage’ page, which is default displayed first. The page includes two tabs ‘List Books’ and ‘Book
Out on Loan’ are showed under the logo, the members click on name of each tab to choose the displayed
data. On ‘List Books’ tab, the librarians see and check total of books, information of each book such as id,

category, title, author, etc. They also can delete books by using button.

18
(9)

Figure 13. Book Manage Page (List Books tab)

To display the data of collection books in library or delete a book, two procedures ‘Infor’ are created
as follows:

➢ Showing total books (9)


SELECT COUNT(BookID) as TotalBook FROM Book
Showing list books
CREATE VIEW ListBook
AS
SELECT B.Title, A.AuthorName, B.Publisher, B.DateOfPublication FROM Book B
JOIN Author A ON A.BookID = B.BookID
SELECT * FROM ListBook

19
➢ Delete Book
CREATE PROC DeleteBook
@BookID INT
AS
DELETE FROM Book WHERE BookID = @BookID
SET @BookID = (SELECT MAX(BookID) FROM Book)
DBCC CHECKIDENT ('Book', RESEED, @BookID)

‘Book Out on Loan’ tab show a list books out on loan with the id of members who borrowed the books,
date issued, date due to returned and status (‘not returned’ or ‘returned’). This tab helps the librarians to
control borrowed and returned books, check the available or unavailable of each book, also update the
data if the librarians click on ‘Update’ button (the book has status “Returned” will be deleted).
(11)

(12)

(13)

Figure 14. Book Manage Page (Book Out on Loan tab)

20
All of the data are displayed by creating four procedures ‘ListOutOnLoan’, ‘TotalBorrowed’,
‘TotalReturned’ and ‘DeletedBookOOL’.

➢ Displaying list book out on loan


CREATE VIEW ListOutOnLoan
AS
SELECT BookBorrowID, UserID, BookID, DateIssue, DateDueForReturn, Status
FROM BookOutOnLoan
SELECT * FROM ListOutOnLoan

➢ Displaying total book borrowed (11)


CREATE PROC TotalBorrowed
AS
SELECT COUNT(DISTINCT BookBorrowID) FROM BookOutOnLoan
GROUP BY UserID, DateIssue, DateDueForReturn
HAVING Status = 'Not returned'

➢ Displaying total book returned (12)


CREATE PROC TotalReturned
AS
SELECT COUNT(DISTINCT BookBorrowID) FROM BookOutOnLoan
GROUP BY UserID, DateIssue, DateDueForReturn
HAVING Status = 'Returned'

➢ Updating book out on loan tab (13)


CREATE PROC DeleteBookOOL
AS
BEGIN
DECLARE @BookBID INT
DELETE FROM BookOutOnLoan WHERE Status = 'Returned'
SET @BookBID = (SELECT MAX(BookBorrowID) FROM BookOutOnLoan)
DBCC CHECKIDENT ('BookOutOnLoan', RESEED, @BookBID)
END

21
‘Rules Manage’ page show all rules of the library and has the same functions with ‘List Book’ tab,
where the librarians are able to add, edit or delete every item. The queries for each functions of the page
are showed under the user interface image.

Books Members Rules

(14)

Figure 15. Rule Manage Page

➢ Showing total rules (14)


SELECT COUNT(RuleID) FROM Rules

➢ Showing list rules


CREATE VIEW ListRule AS
SELECT * FROM Rules

➢ Deleting a rule
CREATE PROC DeleteRule
@RuleID INT
AS
DELETE FROM Book WHERE RuleID = @RuleID
SET @RuleID = (SELECT MAX(RuleID) FROM Rules)
DBCC CHECKIDENT ('Rules', RESEED, @RuleID)

22
‘Members Manage’ page has two tabs ‘Loan Book’ and ‘Overdue Fine’, while ‘Loan Book’ tab shows
a list includes member ID, the quantity of books borrowed, date issued, date due to returned of the
member who has loaned books, ‘Overdue Fine’ tab displays the data of the members who violate the
library rules.

(15)

(16)

Date Returned

Figure 16. Member Manage Page (Overdue Fine tab)

➢ Showing total members violate the library rules (15)


SELECT COUNT(UserID) FROM BookOutOnLoan GROUP BY UserID HAVING RuleID != ''

➢ Showing list members violate the library rules


CREATE VIEW OverDueFine AS
SELECT COUNT(DISTINCT BookBorrowID) as LoanQty, UserID, DateIssue, DateReturn, RuleID
FROM BookOutOnLoan GROUP BY UserID, DateIssue, DateReturn, RuleID
HAVING RuleID != ''

23
SELECT * FROM OverDueFine

➢ Updating overdue fine tab (16)


CREATE PROC DeleteMOD AS
BEGIN
DECLARE @BookBID INT = (SELECT MAX(BookBorrowingID) FROM BookOutOnLoan)
DELETE FROM BookOutOnLoan WHERE RuleID != ''
SET @BookBID = (SELECT MAX(BookBorrowID) FROM BookOutOnLoan)
DBCC CHECKIDENT ('BookOutOnLoan', RESEED, @BookBID)
END

‘Loan Books’ tab updates new information immediately after the member has completed a loan
request and send a notify messages for the librarian, who has to check new data updated of the tab.

12345

Figure 17. User Manage Page (Loan Books tab)

24
When a member returns the books borrowed, the librarian clicks to the button ‘Return’, which in the
same row with the member id.

➢ Displaying list member borrowed books


CREATE VIEW ListMemBorrowed AS
SELECT COUNT(DISTINCT BookBorrowID) as LoanQty, UserID, DateIssue, DateDueForReturn
FROM BookOutOnLoan GROUP BY UserID, DateIssue, DateDueForReturn
SELECT * FROM ListMemBorrowed

A ‘Books Returned’ form will display includes the data of all books, text boxes to fill date returned,
amount of fine(the amount of fine will be calculated by multiple the overdue date with the rule’s value
after RuleID check boxes are ticked), RuleID check boxes(include the RuleID of the library, the librarian
will tick the boxes if the member violates this rule). However, If the member loses the book, the librarian
will fill the BookID into ‘Lost Items’ text box. In this situation, the amount of fine will be calculated by add
the prices of lost books and administrative fee.

Figure 18. Books Returned form

25
After finished checking the books returned, the librarian clicks on ‘Save’ button to save the value of
Date return, Lost items (if the member loses the book borrowed) or Amount of rule (if the member
violates the library rules).

➢ Returning books
CREATE PROC ReturnBook
@UserID VARCHAR(7), @RuleID INT
AS
BEGIN
DECLARE @AOF DECIMAL, @DateReturn DATE
SELECT @DateReturn = GETDATE()
IF @RuleID = 1
UPDATE BookOutOnLoan SET Status = 'Returned', RuleID = @RuleID, DateReturn = @DateReturn,
AmountOfFine = DATEDIFF(DAY,CAST(DateDueForReturn as DATE),@DateReturn) * 5 WHERE UserID
= @UserID
IF @RuleID = 2
UPDATE BookOutOnLoan SET Status = 'Returned', RuleID = @RuleID, DateReturn = @DateReturn,
AmountOfFine = DATEDIFF(DAY,CAST(DateDueForReturn as DATE),@DateReturn) * 10 WHERE UserID
= @UserID
IF @RuleID = 3
UPDATE BookOutOnLoan SET Status = 'Returned', RuleID = @RuleID, DateReturn = @DateReturn,
AmountOfFine = DATEDIFF(DAY,CAST(DateDueForReturn as DATE),@DateReturn) * 20 WHERE UserID
= @UserID
IF @RuleID = null
UPDATE BookOutOnLoan SET Status = 'Returned', DateReturn = @DateReturn WHERE UserID =
@UserID
END
In addition, the data of the member on ‘Loan Books’ tab will be deleted if the librarian clicks on
‘Update’ button.
➢ Deleting the data of the member on loan books tab
CREATE PROC DeleteBookOOL
AS
BEGIN
DECLARE @BookBID INT
DELETE FROM BookOutOnLoan WHERE Status = 'Returned'
SET @BookBID = (SELECT MAX(BookBorrowID) FROM BookOutOnLoan)
DBCC CHECKIDENT ('BookOutOnLoan', RESEED, @BookBID)
END

26
II. Database System
1. Data Sample
USERS
UserID FName LName Email Password Role Phone Address

GCH1234 Van A Nguyen ANVGCH1234@fpt.edu.vn abc@123 Member 0123456789 30st, Hai Ba


Trung District,
Hanoi

GAB1111 Thi B Pham BPTGAB1111@fpt.edu.vn 12345 Librarian 0167891011 Cau Giay


District, Hanoi

BOOK
Book Title Description Date of Publisher Qty Category Location
ID Publication ID

1 Database “Here practical help for August 1, Paper Park 3 IT 100


Concepts understanding, creating, 2014
managing database…”

2 Database “Database System August 1, Paper Park 1 IT 100


System Concepts, by Abraham 2014
Concepts Silberschatz and Hank
Korth, is a classic textbook
on database systems.”

AUTHOR CATEGORY
BookID AuthorName CategoryID Name

1 David M.Kroenke, David J.Auer IT Information Technology

2 Abraham Silbercharzt GD Graphical Design

LOCATION RULES
LocationID Name Time RuleID Description Value

100 Location A Morning - 3pm 1 Overdue date from 1 day to 7 days: 5.00
$5/book/day
101 Location B Noon - 9pm 2 Overdue date from 8 day to 15 days: 10.00
$10/book/day
102 Lab room Morning - 10pm 3 Overdue date from more than16 days: 20.00
$20/book/day

27
BOOK OUT ON LOAN
Book UserID BookID DateIssue DateDue Date Status RuleID Amount
BorrowID ForReturn Return OfFine

1 GCH1234 1 2019-04-10 2019-04-17 NULL Not Returned NULL NULL

2 GCH1234 2 2019-04-10 2019-04-17 NULL Not Returned NULL NULL

*Data simples do not include all of the data are displayed on the illustrating images of user interfaces

2. Testing
After the database is implemented, testing starts. However, in the scope of this report where the
function of an online library system is focused on simple user requirements such as select, insert, update
and delete data, full set of test cases or negative testing are all omitted. The effectiveness and correctness
of the used database will be tested following some most typical test cases. Test data used in the test log
include correct and incorrect data. While the former checks SQL statements execute successful or not;
the latter with data type, which do not match data type of the checked attribute will perform validation
of input.

TEST PLAN
Test What is being test How Data user Expected
Result

1 User account update Enter typical values, values that Data type 1 Good data
should be reject. accepted, bad
data rejected.

2 Book insert, update, Enter typical values, values that Data type 1 Good data
delete should be reject. accepted, bad
data rejected.

3 Rule insert, update, Enter typical values, values that Data type 1 Good data
delete should be reject. accepted, bad
data rejected.

Table 1. Test plan

TEST LOG

Case Description Steps/Input data Expected Result Actual Status


ID Result
1 Verify the SQL • UPDATE Users SET Phone = • Update data Data Passed
'?' , Address = '?' WHERE changed
query when user UserID = '?'; successful
where

28
edits an account • Phone = '016789123' • Messages box shows UserID is
,Address = '18st, Ba Dinh, GCH1234
information Hanoi' WHERE (UserID = (1 row(s) affected)
'GCH1234');

2 Verify the SQL • INSERT INTO • Insert data successful A new book Passed
Book(Title,Description, added into
query of the DateOfPublication, • Messages box shows table
Publisher,Quantity,
function adding a CategoryID,LocationID) (1 row(s) affected)
VALUES(?,?,?,?,?,?,?,?);
new book
• 'Database Concepts','Here
practical help...',
'August 1, 2014','Paper
Park',3,'IT',100, 'David
M.Kroenke, David J.Auer'

3 Data validation of • INSERT INTO • Insert data Add a new Passed


Book(Title,Description) book failed
inserting a new VALUES(?,?); unsuccessful, Title and

book query • 123,123 Description must be


string
• Messages box show
error message
4 Verify the SQL • UPDATE Book SET Title = • Update data Data Passed
'?', Description = '?', changed
query of the DateOfPublication = '?', successfully
where
Publisher = '?', Quantity
function editing a = ?, CategoryID = '?', • Messages box shows BookID is 3
LocationID = '?'WHERE
book BookID = @BookID;
(1 row(s) affected)

• BookID = 2, Title =
'Design Pattern',
Description = 'abcd',
DateOfPublication =
'2001/09/12', Publisher =
'ccc', Quantity = 2,
CategoryID = 'IT',
LocationID = 101;

5 Data validation of • UPDATE Book SET Title = • Insert data Update a Passed
'?', Description = '?', book failed
editing a book WHERE BookID = @BookID; unsuccessful, the data

query • BookID = 'abc',Title = type of BookID is


'Design Pattern', integer and Description
Description = 123
is string

29
• Messages box show
error message
6 Verify the SQL • DELETE FROM Book WHERE • Delete successful Delete the Passed
BookID = ? book where
query of the • BookID = 1 • Messages box shows
BookID = 1
function deleting a (1 row(s) affected) from the
table Book
book when the
librarian clicks on
delete button
7 Verify the query • DELETE FROM Book WHERE • Delete unsuccessful No data Passed
BookID = ? deleted
delete a book when • BookID = 1000 • Messages box shows
BookID is not exist (0 rows affected)
in Book table
8 Verify the SQL • DELETE FROM Rule WHERE • Delete successful Delete the Passed
RuleID = ? rule where
query of the • RuleID = 1 • Messages box shows
RuleID = 1
function deleting a (1 row(s) affected) from the
table Rule
rule when the
librarian clicks on
delete button
Table 1. Test log

3. Maintaining
SQL Server provides three backup types as follows:

➢ Full backup: backup all data at that time.


➢ Differential backup: backup of newly updated data pages since the last full backup.
➢ Backup log transaction: backup existing log records in log file, backup actions (actions happen to
the database), not back up data, also truncate the log file, remove the log records from the log
file.

Backup plan for the database system:

➢ Full backup: once a day at 2am.


➢ Differential backup: at 6h, 10h, 14h, 18h, 22h (5 times / day).
➢ Backup log transaction: every 15 minutes at times 5 ′, 20 ′, 35 ′, and 50 ′ of each hour (4 times /
hour). Select such a time to ensure it occurs after differential backup.

30
The script to perform backup using all three backup types mentioned.
USE OLS
-- full backup
BACKUP DATABASE OLS TO DISK = 'D:\Backup\OLS_FULL.bak'
WITH INIT
-- add a new record
INSERT dbo.Book VALUES('Database Introduction','Here practical help...', 'August 1,
2014','Paper Park',3,'IT',100, 'Anabelle K.Maria')
-- differential backup
BACKUP DATABASE OLS TO DISK = 'D:\Backup\OLS_DIFF.bak'
WITH INIT, DIFFERENTIAL
-- add a new record
INSERT dbo.Book VALUES('Database Manage','Here practical help...', 'May 1,
1999','VAA',1,'IT',100, 'Robert A.Martin')
-- transaction log backup
BACKUP LOG OLS TO DISK = 'D:\Backup\OLS_TRAN.trn'
WITH INIT
-- add a new record
INSERT dbo.Book VALUES('Adobe Photoshop CG6','Here practical help...', 'August 1,
2014','Paper Park',2,'GD',101, 'Adobe')
-- transaction log backup again
BACKUP LOG OLS TO DISK = 'D:\Backup\OLS_TRAN.trn'
After the first add a new record, the system makes a full backup. The first full backup, differential
backup and transaction log back up have “WITH INIT” statement, that mean whenever these commands
run, the existing file will be over wrote by the new file. However, when the database does transaction
log back up again, this statement is not be used, so the transaction log backup appends to each other
and all of these are maintained.

31
III. Technical Document
Introduction
Based on user requirements, the schema of the OLS database consists of seven files or tables
correspond to entities, namely: User (Member/Librarian), Book, Author, Category, Book out of loan,
Location and Rule. The document provides the logical design and physical design of the OLS, which will
show below.

1. Logical Design
The schema consists of seven files or tables correspond to entities, namely: User (Member/Librarian),
Book, Author, Category, Book out of loan, Publisher, Location and Rule. Each table includes fields or
attributes of an entity. Then the relationship between these entities will be identifying.

User table contains the corresponding fields to store user’s information such as user name (Name),
user email to log in the Online Library System (email), user phone number and address to contact (Phone,
Address). The email and Phone attributes must be unique and different between users, because these
attributes are personal information to identify user. Due to the database controls data consistence by
reduce multiple copies of the same data, each table is initialized with a single id, and in the User table, the
id is UserID. The id attribute usually is the primary key (PK) of a table.

Author table (storing author information), Category table (the categories are in the library), Location
table (physical locations store books) and Rule table (the description and value of library rules), these
tables will add more detailed data for Book table: the author of the book, the category of the book and
the address of the book in the library. The Book table contains basic information such as title, description,

32
date to publication, quantity of books and foreign keys (FK) CategoryID, LocationID reference from the
Category and Location tables.

Book out on loan table was created to represent the way user borrow and return books, so this table
will include the following fields: DateIssue (the date that user made a request to borrow books),
DateDueForReturn ( the due date that user is required to return the books), DateReturn (the date that
user returned the books to library), status (such as "Returned by the due date" or "Books has not been
returned"). Because the borrowed books process will record as a detail of transaction and stored as the
history of each transaction, the attributes DateReturn, RuleId, and AmountOfFine will be null until the
item is returned. If the date user returned books is more than the date due for return, the AmountOfFine
value will be filled suitable for the RuleId value. To display user and book information borrowed, the Book
out on loan table is added two foreign keys UserID and BookID reference from User and Book tables.
These foreign keys are used to create links between tables and make database queries easier.

After all tables of database were represented, the relationship of these will be explained. A book can
be borrowed or not, an author writes at least one books, a physical location stores many books, and a
category has several books. Therefore, the relationship between book and book of loan, author and book,
location and book, category and book are one to many. In addition, at least one book is borrowed by only
one user at a time, also users can borrow less than 7 books, so the relationship between book and user is
many to one.

2. Physical Design
The data type of fields in tables User, Author, Category, Location, Book, Rule and Book out on loan
will be showed in the table below (these physical design follow 3rd Normalization Form)

Primary Key/
Table Name Data Type Not null
Foreign Key

UserID Varchar (7) ✓ Primary key


FName Varchar (50) ✓
LName Varchar (50) ✓
User Email Varchar (50) ✓
Password Varchar (50) ✓
Phone Varchar (11)
Address Varchar (100)

33
Primary key,
BookID Int ✓
Author Foreign key
AuthorName Varchar (100) ✓ Primary key
CategoryID Varchar (7) ✓ Primary key
Category
Name Varchar (30) ✓
LocationID Varchar (7) ✓ Primary key
Location Name Varchar (7) ✓
ShelfNum int
BookID Int ✓ Primary key
Title Varchar (50) ✓
Description Varchar (200) ✓
DayOfPublication Date ✓
Book Quantity Int ✓
Image Image
Publisher Varchar (100) ✓
LocationID Int ✓ Foreign key
CategoryID Varchar (7) ✓ Foreign key
RuleID Varchar (7) ✓ Primary key
Rule Description Varchar (100) ✓
Value Decimal ✓
BookBorrowID Varchar (7) ✓ Primary key
BookID Varchar (7) ✓ Foreign key
UserID Varchar (7) ✓ Foreign key
RuleID Varchar (7) Foreign key
BookOutOnLoan DateIssue Date ✓
DateDueForReturn Date ✓
DateReturn Date
Status Varchar (50)
AmountOfFine Decimal
Table 1. Physical Design

34
3. User Case Scenario

In this project, the actors are Member and Librarian, who interact with the system. For example, when
they make an action provide input such as click on a button or fill to a form, or receive output data, which
are the information of a book that they selected. The user case diagram begins when the actors enter
their email and password included in login to the OLS case. The Members are able to search, select then
loan books and return book at the date due to returned. Meanwhile, the Librarians add new book (or
library’s rule), edit or delete current books (or rules), they also manage members who loaned books and
receive books from members. The user case diagram doesn’t include pay overdue fine (case for members
who return book late) and receiving fines case.

35
IV. User Document
The user document introduces steps to guide users who consume the OLS system, this include two
part for two groups of users (Member/Librarian). The first part is Member Guideline and the second part
is Librarian Guideline. However, both Member and Librarian have the same log in interface, so the way to
use this interface will be showed first.

Login System Guideline

Users see the OLS system login interface after accessing the link of the website and
button on the left side of this interface.

Then users are redirected to Google login form, where they will enter their email and password, after

click on button.

36
Users fill google mail into 'Email or phone' text box, then click on 'Next' button and enters the
password into 'Password' text box as the image illustration, finally, click on 'Sign in' button. If the email
and password are correct, users will login successfully to the OLS. On the contrary, when google email or
password is incorrect, users will receive a notification and request to fill the login form again.

37
Member Guideline
The Output Interfaces of Member include Home page, Search Book Results page, Book Detail Page
and User Account page, which will be showed below.

On the home page, the member can search books and view other information about the library such
as, opening and closing hours of locations, the list of updated books and the library contact button. The
user enters the book’s title, the author's name or the category’s name corresponding to the option

selected below the search bar, then clicks on button to search the book.

A page including the search results will appear after the member presses button. Search results
display image, title, author, date of publication, the publisher of the book searched, also have ‘Borrow’
button and ‘Read more’ button for each result, which will be showed below.

38
Members click on button next to each book to borrow the book. A messenger box containing
information about the borrowed book, date issue and date due to return will appear after completing a
member's borrowing request.

OK
Members click button to finish this request. If the book is not available, this button will turn

into gray , and users cannot click it to borrow the book.

39
Additionally, if the member wants to know more about the book such as description and location,

click on button, then a detailed information page about that book will be displayed.

On the header of the website will display the member's account icon, to edit account information, the

member clicks on icon.

Then a page including the member's personal information will be showed. On this page, the member

clicks on button to edit account. Because every account is created and managed by
administrator, the member only changes the information in the Contact and Other section.

40
Save

Save
When the member has finished edit their account, click button on bottom left side of the
page to save new information.

Library Guideline
The Output Interfaces of Librarian include ‘Books Manage’ page, ‘Members Manage’ page and ‘Rules
Manage’ page, which are very useful for the librarians to manage data.

To add a new book (or a new rule), the librarians click to ‘Add new book’ button (or ‘Add new rule’
button) on the right side of Book Manage page (Rule Manage page).

41
Add a new book form display after the librarians click on ‘Add new book’ button. In this form, the
librarians fill the information of a new book, and click on ‘Save Book’ button to save the data. In addition,
users click on ‘Cancel’ button to close the form and ‘Reset’ button to clear texts in all text boxes.

42
‘Books Manage’ page has ‘List Books’ tab and ‘Book Out on Loan’ tab, in which ‘List Books’ tab displays
all of the books stored in the library database. The librarians see and check total of books, information of

each book such as id, category, title, author, etc. They also can delete books by using button.

On ‘Books Manage’ page, each book has an edit button to help the librarians change the data of
the book. When the librarians click on the button, an Edit book form will display includes the current
information. After changing the data, the librarians click on button ‘Save’ to save new data of the book or
click on ‘Cancel’ button to close the form.

43
‘Book Out on Loan’ tab show a list books borrowed with the id of members who borrowed the books,
date issued, date due to returned and status (‘not returned’ or ‘returned’). This tab helps the librarians to
control books borrowed and returned, check the available or unavailable of the books, also update book
borrowed data automatically whenever members have completed a loan request.

44
‘Rules Manage’ page show all rules of library database and has the same functions with ‘List Book’
tab, the librarians are able to add, edit or delete every rule. On the page, the librarian can see the total of
rules, the id, description, amount of fine of each rule.

45
‘Members Manage’ page has two tabs ‘Loan Book’ and ‘Overdue Fine’, while ‘Loan Book’ tab shows a
list includes member ID, the quantity of books borrowed, date issued, date due to returned of the member
who has loaned books, ‘Overdue Fine’ tab displays the data of the members who violate the library rules.

46
‘Loan Books’ tab updates new information immediately after the member has completed a loan
request and send a notify messages for the librarian, who has to check new data updated of the tab.

When a member returns the books borrowed, the librarian clicks to the button ‘Return’, which in the
same row with the member id. A ‘Books Returned’ form will display includes the data of all books, text
boxes to fill date returned, amount of fine(the amount of fine will be calculated by multiple the overdue
date with the rule’s value after RuleID check boxes are ticked), RuleID check boxes(include the RuleID of
the library, the librarian will tick the boxes if the member violates this rule). However, If the member loses
the book, the librarian will fill the BookID into ‘Lost Items’ text box. In this situation, the amount of fine
will be calculated by add the prices of lost books and administrative fee.

47
After finished checking the books returned, the librarian clicks on ‘Save’ button to save the value of
Date return, Lost items (if the member loses the book borrowed) or Amount of fine (if the member violates
the library rules).

V. Evaluate
The designed system will help to solve current problems in library management system, which are
mainly:

➢ To the students: available to search books and make request online


➢ To library staff:
o Easy to manage books in the library, students’ requests, and remind of return date
(following the library rules)
o Easy to verify student identification and availability of book (current and new coming to
update the catalog)
o Avoiding common mistake in processing the borrowed and coming books information
(with administration account in higher security system)

Recommendations:

48
➢ Adding administration right to teacher account:

At very high possibility, the new system will be completed with different access for student/faculty
and library staff. (While the students and lecturers in the university can only make a request to borrow
books and searching books on the system, library staff has full right of administration.) However, there
would be a more promising way for the distinguished rights between student account and teacher account
based on the existence of Teacher materials section in the library. Teacher also can set up access for
students in their class to borrow a specific material in that section (administration right).

➢ Adding automatic function of sending warning email

Another recommendation for the system upgrade as soon as it is possible is the automatic function
to send reminding email to the student about the date to return books (including warning message about
library rules). Currently, it is proposed to be done by librarians.

➢ Update information about book availability in details

For the ‘high demand’ books, which are in limited quantity in the library but always requested by
many students (typically course books), their availability should be displayed in exact time such as 3:00
pm on DD/MM/YYYY. No time wasted to take the book and avoiding too many pending requests (the
student keeping the book are required to return it on set time, and the ones who need it will know exactly
when they should send their request to borrow it).

It may be more convenient for student if they can see the availability of all books in that detailed time
format.

➢ Adding ‘Donate a book’ section:

To expand the source for books in library, it is suggested that a section for donate a book be created.
Students/teachers can make a request to donate a book with similar form (without book ID) with the
request form. The librarian then processes the request, add book ID and insert the book information in
‘Donated book’ section (which is similar with the other books in the library in addition with the info of
‘Donated by’ name of person).

49
References
1. Vu Huy Tam, SQL Viet Blog, view 8 May 2019, < http://www.sqlviet.com/blog/cac-kieu-backup-
trong-sql-server>.

2. Database Lecture, chapter 1 – 15, Document of Greenwich University Vietnam

50

You might also like