Professional Documents
Culture Documents
Adatabasedesignreportforcollegelibraryfinal 110919182400 Phpapp01
Adatabasedesignreportforcollegelibraryfinal 110919182400 Phpapp01
Saira Iqbal
Concepts on Database
L0290KKKK1110
MSc (IT)QP
Abstract
Library managment refers to the issues involved in manging the resources available in library such as
classification of material, book processing and borrowing materials. UK market is mature and
different systems are employed by the libraries to manage their resources in an efficient manner but
still many libraries remain unconvinced and show reluctance to employ and switch over to new
systems
In the following sections I will analyse the limitations of existing manual system employed by a
college library and will mainly focus on the solution to provide a centralised repository enabling the
library administrator to store, access and process the information when required. A prototype of the
database to hold the information will be designed considering the available techniques and
methodologies and then finally the new system prototype will be created in the light of
recommendations and outcomes of the initial analysis and design. MySQL DBMS will be
recommended and used for developing the prototype of the system. I will use relational database
system to represent the relation between assets of library and which will shows the data library holds.
Report will also include a complete illustration of the final prototype and justification of adopting the
methodologies and technologies.
Saira Iqbal Page 2 of 19
Contents Page
Section..............................................................................Page Number
1. Introduction............................................................................3
1.1. Background..3
1.2. Objective..3
1.3. Scope3
3.1.1.Current System4
3.1.2.Weakness of Current System......4
3.2.0.New System5
3.2.1.Features of Proposed System..5
4. Literature Review......................................................................5
4.1.Requirement Analysis5
7. Conclusion.................................................................................18
8. Recommendations.....................................................................18
9. References.................................................................................18
List of Figures
1.0 Introduction
1.1 Background
Library database system is designed to maintain the library assets in a suitable way.This report is
about a rational database design of a college library in which members of the library can keep track
on availability of books, information about membership either they are student or staff of college, they
can join or leave library and some responsibilities of librarians are added.
The core goals of this report are to define the entities, attributes and their relationship to create a
database that can be easily manage by admin.
Following are the facilities:
Librarian: can find if the book is available or not its status and how much fine is due
Member: can borrow & return books and can leave and join library
In the report the findings describe the deficiency of data keeping method and, which can be increase
the budget to hire manpower. Following these findings, conclusions are drawn and a number of
recommendations are made as to how to increase the reliability of data, reduce redundancy and
accessibility to data has been made stress-free.
1.2 Objectives
The objectives of this report are to provide complete database for college library which will help to
minimize the duplication of data, get rid from paper filling system and it makes the processing of data
very easy without waste of time.
1.3 Scope
This report examines that any educational system can use it in their libraries to determine about the
author detail, publishers detail, availability of books, can track members record etc. and it is very
easy to modify by making changes in database. It does not examine online system of library
MS word 2010
world of technology and develompment so people prefered to use computer based systems rather than
manual.
2.1 Advantages of Computer based library management system
Less expensive because only once you need to spend money on system
No duplication of records
Occupy less space as for paper based system there should be separate space to keep them
Security of the system by authorizating access to limited people according to their rights
2.3 Disadvantages
It required high conversion cost to transform file-based system into computer based system
i- Membership
Students needs to get membership by filling a new membership form available in
library
and provide this form to librarian with deposit of 25 which are refundable at the end of
course.
When student come to return book the librarian check in a record register the data of issue
and date of return of book along with the book card and student card and return the student
membership card to student and place book in rack in sorted manner
.
iv- Fine Calculated
If the due date of books is passed then librarian calculated the difference between the issue
date of book and return date of book. Fine is considered to be 50 p per day after due date.
Expensive
By in/out process of cards may cause damage to card which create problem to identify which
book is issued to which student
Loss of assets
Borrowing of book become easy because in database librarian can find in seconds if this is
book is issued to someone else or not
Students need to register in library to get membership which has limit of one year so at time of
registration he needs to provide his name, course name, id, DOB and address. A library card can be
issued to him after storing details in system.
Books has unique number for their identity and category type, author name, publisher name, copy
number etc. and library must have record of which book is issued to which member of library and
either its return on time or not and calculation of fine overdue.
When a student borrows a book an entry of his name is entered in database by librarian and return
date is automatically comes up in system. It also shows how many books are issued to one member.
They can only borrowed maximum of five books at a time.Before borrowing any book members of
library can check if the book is available or not.
Add members
Add library cards and assign them to members
Handle returns
Check fines
There are three phases of database system design model, one is conceptual design second is logical
design and third is physical model in which data has been placed in database. In our system all these
three phases have been designed and described accordingly.
It is cleared from above discussion that main entities of Library are , members (student or staff),
books and librarians which store data regarding any queries e.g. how many books are borrowed, fine
payable etc. In this diagram we try to show possible entities and their relationship with each other and
what attributes they hold. Using ER Design redundancy of many items can be reduced and its a good
practice to show relation among entities.
A borrowed transaction must only be associated with one and only one member (1:1)
logically yes but in database its 1:* because there will be always one active
Saira Iqbal Page 8 of 19
Relationships:
Name Relationship Parent Child Cardinality
type
author_books_by_author Identifying author books_by_author Zero Or More
Table: Books
Column name Primary key Data type Not NULL Comment
book_id {PK} Yes INTEGER Yes PRIMARY KEY (book_id)
pub_id {FK} No INTEGER No FOREIGN KEY (pub_id)
REFERENCES
Publisher(pub_id)
book_title No VARCHAR(40) No Title of book
edition No VARCHAR(40) No Name of publisher
availability No BOOL No Book available or not
num_of_copies No INTEGER No Quantity of books
state No VARCHAR(40) No Good,bad,excellent
catalog_number No INTEGER No Rack number
row_number No INTEGER No Rows in a rack
active No BOOL No Is book stolen, damage or lost
then it would be 0 otherwise 1
Created_by No VARCHAR(40) No For internal auditing purpose
name of librarian who created
entry in DB
Updated_by No VARCHAR(40) No For internal auditing purpose
name of librarian who updated
entry in DB
created No DATETIME No Date time of creation
updated No DATETIME No Date time of updating
Relationships:
Name Relationship Parent Child Cardinality
type
books_books_by_author Identifying books books_by_author Zero Or More
books_books_by_category Identifying books books_by_category Zero Or More
books_borrow_transaction Non Identifying books borrow_transaction Zero Or More
Publisher_books Non Identifying Publisher books One Or More
Table: books_by_author
Column name Primary key Data type Not Comment
NULL
author_id Yes INTEGER Yes PK & FOREIGN KEY (author_id)
REFERENCES author(author_id)
book_id Yes INTEGER Yes PK & FOREIGN KEY (book_id)
Saira Iqbal Page 10 of 19
REFERENCES books(book_id)
Relationship:
Name Relationship Parent Child Cardinality
type
author_books_by_author Identifying author books_by_author Zero Or More
books_books_by_author Identifying books books_by_author Zero Or More
Table: books_by_category
Column name Primary key Data type Not Comment
NULL
category_id Yes INTEGER Yes PK & FOREIGN KEY (category_id)
REFERENCES
Categories(category_id)
book_id Yes INTEGER Yes PK & FOREIGN KEY (book_id)
REFERENCES books(book_id)
Relationships:
Name Relationship Parent Child Cardinality
type
books_books_by_category Identifying books books_by_category Zero Or More
Categories_books_by_category Identifying Categories books_by_category Zero Or More
Table: Borrow_Transactions
Column name Primary Data type Not Comment
key NULL
borrow_transaction_id Yes INTEGER Yes PRIMARY KEY
(borrow_transaction_id)
librarian_id No INTEGER Yes FOREIGN KEY
(librarian_id)
REFERENCES
librarian(librarian_id)
book_id No INTEGER Yes FOREIGN KEY (book_id)
REFERENCES
books(book_id)
member_id No INTEGER Yes FOREIGN KEY
(member_id)
REFERENCES
members(member_id)
borrowed_datetime No DATETIME No When the book is borrowed
returned_datetime No DATETIME No When the book is returned
borrowed_by No VARCHAR(40) No Who borrowed (name of
member)
returned_by No VARCHAR(40) No Who returned
date_due No DATE No Due date of book borrowed
is_returned No BOOL No If returned 1 otherwise 0
created_by No VARCHAR(40) No For internal auditing
purpose name of librarian
Saira Iqbal Page 11 of 19
Relationships:
Name Relationship Parent Child Cardinality
type
books_borrow_transaction Non books borrow_transaction Zero Or More
Identifying
borrow_transaction Non borrow_transaction fined_transactions Zero Or One
_fined_transactions Identifying
librarian_borrow_transaction Non librarian borrow_transaction Zero Or More
Identifying
members_borrow_transaction Non members borrow_transaction One Or More
Identifying
Table: Categories
Column name Primary key Data type Not Comment
NULL
category_id Yes INTEGER Yes PRIMARY KEY (category_id)
category_name No VARCHAR(40) No Name of category e.g Science,
Crime etc
Relationships:
Name Relationship Parent Child Cardinality
type
Categories_books_by_category Identifying Categories books_by_category Zero Or More
Table: Fined_Transactions
Column name Primary Data type Not Comment
key NULL
fined_transaction_id Yes INTEGER Yes PRIMARY KEY (fined_transaction_id)
member_id No INTEGER Yes FOREIGN KEY (member_id)
REFERENCES members(member_id)
librarian_id No INTEGER Yes FOREIGN KEY (librarian_id)
REFERENCES librarian(librarian_id)
borrow_transaction_id No INTEGER Yes FOREIGN KEY (borrow_transaction_id)
REFERENCES
borrow_transaction(borrow_transaction_id)
amount_added No VARCHAR(40) No Total Amount Fined
amount_received No VARCHAR(40) No Amount received till date
notes No VARCHAR(40) No To add notes
deleted No DATETIME No Date & Time of Deletion
created No DATETIME No Date & time of transaction creation
created_by No VARCHAR(40) No For internal auditing purpose name of
librarian who created entry in DB
Saira Iqbal Page 12 of 19
Relationship:
Name Relationship Parent Child Cardinality
type
borrow_transaction Non borrow_transaction fined_transactions Zero Or
_fined_transactions Identifying One
librarian_fined_transactions Non librarian fined_transactions Zero Or
Identifying More
members_fined_transactions Non members fined_transactions Zero Or
Identifying More
Table: Librarian
Column name Primary Data type Not Comment
key NULL
librarian_id Yes INTEGER Yes PRIMARY KEY
(librarian_id)
name No VARCHAR(40) No Librarian Name
user_name No VARCHAR(40) No User name assigned to
librarian
password No VARCHAR(40) No Password for login
created_by No VARCHAR(40) No For internal auditing
purpose name of librarian
who created entry in DB
updated_by No VARCHAR(40) No For internal auditing
purpose name of librarian
who updated entry in DB
created No DATETIME No Date time of creation
updated No DATETIME No Date time of updating
active No BOOL No If librarian is active or
not
inactive_reason No VARCHAR(40) No Why not active
Relationship:
Name Relationship Parent Child Cardinality
type
librarian_borrow_transaction Non Identifying librarian borrow_transaction Zero Or More
librarian_fined_transactions Non Identifying librarian fined_transactions Zero Or More
librarian_membership Identifying librarian membership Zero Or More
Table: Members
Column name Primary Data type Not Comment
key NULL
member_id Yes INTEGER Yes PRIMARY KEY
(member_id)
external_id No INTEGER Yes ID For library use
member_type No VARCHAR(40) No Either its staff or student
member_name No VARCHAR(40) No Name of member
Saira Iqbal Page 13 of 19
Relationships:
Name Relationship type Parent Child Cardinality
members_borrow_transaction Non Identifying members borrow_transaction One Or More
members_fined_transactions Non Identifying members fined_transactions Zero Or More
members_membership Identifying members membership Exactly One
In logical design model we can see the all entities, their data types, constraints on them and their
relations.
5.3 Normalization
Tables in database are designed to use third normal form (3NF). As we know that to use third normal
form our table must satisfy the requirement of first normal form ((1NF) and second normal form
(2NF).Most of the tables in database have been designed to keep optimization in mind. We use
normalization to remove update, delete & insert anomalies.
I have used the following way to normalize my tables. I have explained only one table here:
1NF
By implementing First Normal formal I have to check that there should be no multiple values against
any field of a table and I have to create a separate table for each set of related data with unique
primary key. To apply first normal form I make some changes in above table, I separate author_name
field into two fields (first name & last name) and identify book_id as primary_key.
2NF
For 2nd Normal form the non key attributes should be fully dependent on composite primary key,
partial dependency is not allowed.
First I created two tables from above tables to associate with repeating group of data and relate them
with foreign key. After this I have to check that each non-key field in the table will be an attribute that
describes that Primary Key
Saira Iqbal Page 14 of 19
Books Table
Book_id Book_title Edition Book_categories Publisher
Author Table
Book_id author_fname author_lname
By using 2NF two tables created books table with books detail but no repeat fields as in 1NF and
author table associated with books table none of no-key element is partially dependent on primary
key.
3NF
The final normalization of my table is 3rd normal form. To achieve this normal form I have to
eliminate the non-key values which are not fully functionally dependent on primary key of the table.
Author Table
As author name is not directly dependent on book id so a separate table is created for it with its own
primary key id
author_id First_name lastname
11 Denial Shah
12 Iqbal Mittal
Book_by_author Table:
The relationship between book and author table is maintained in book_author table which is many to
many as many a book has many authors and an author can write many books. This relation is
established by creating a third table book_author which maps book to author and vice versa. This
table contains two fields both as foreign keys which refer to book and author table respectively to
establish one to many relationship on both sides.
Book_id author_id
5001 11
5002 122
Books Table
Publisher id is used as foreign key.
Same rule is applied for category table as authors table. The membership is separated from members
table to avoid functional dependency. And similarly we split publisher table from books table to avoid
data duplication. fined_transactions table is kept separate from borrowed_transactions table in order to
minimize redundancy.
After logical design of database I put data in database to create table and their attributes, I run
following queries in MYSQL console:.
Add Table books
------------------------
CREATE TABLE `books` (
`book_id` INTEGER NOT NULL,
`book_title` VARCHAR(40),
`edition` VARCHAR(40),
`pub_name` VARCHAR(40),
`pub_date` DATE,
`availability` BOOL,
`num_of_copies` INTEGER,
`state` VARCHAR(40),
`catalog_number` INTEGER,
`row_number` INTEGER,
`active` BOOL,
`created_by` VARCHAR(40),
`update_by` VARCHAR(40),
`created` VARCHAR(40),
`updated` VARCHAR(40),
CONSTRAINT `PK_books` PRIMARY KEY (`book_id`)
);
Add Table borrow_transaction
------------------------------------------
CREATE TABLE `borrow_transaction` (
`borrow_transaction_id` INTEGER NOT NULL,
`librarian_id` INTEGER NOT NULL,
`book_id` INTEGER NOT NULL,
`member_id` INTEGER NOT NULL,
`borrowed_datetime` DATETIME,
`returned_datetime` DATETIME,
`borrowed_by` VARCHAR(40),
`returned_by` VARCHAR(40),
`date_due` DATE,
`is_returned` BOOL,
`created_by` VARCHAR(40),
`updated_by` VARCHAR(40),
`created` VARCHAR(40),
`updated` VARCHAR(40),
CONSTRAINT `PK_borrow_transaction` PRIMARY KEY (`borrow_transaction_id`)
);
Add Table librarian
------------------------------
CREATE TABLE `librarian` (
`librarian_id` INTEGER NOT NULL,
`name` VARCHAR(40),
`user_name` VARCHAR(40),
Saira Iqbal Page 16 of 19
`password` VARCHAR(40),
`created_by` VARCHAR(40),
`updated_by` VARCHAR(40),
`created` VARCHAR(40),
`updated` VARCHAR(40),
`active` BOOL,
`inactive_reason` VARCHAR(40),
CONSTRAINT `PK_librarian` PRIMARY KEY (`librarian_id`)
);
Add Table member
---------------------------
CREATE TABLE `members` (
`member_id` INTEGER NOT NULL,
`external_id` INTEGER,
`member_type` VARCHAR(40),
`member_name` VARCHAR(40),
`phone_number` INTEGER,
`gender` VARCHAR(40),
`email` VARCHAR(40),
`active` BOOL,
`created_by` VARCHAR(40),
`updated_by` VARCHAR(40),
`created` VARCHAR(40),
`updated` VARCHAR(40),
CONSTRAINT `PK_members` PRIMARY KEY (`member_id`)
);
Add Table membership
--------------------------------
CREATE TABLE `membership` (
`librarian_id` INTEGER NOT NULL,
`member_id` INTEGER NOT NULL,
`registred_datetime` DATETIME,
`registred_by` VARCHAR(40),
`membership_status` BOOL,
`membership_expiry_date` DATE,
PRIMARY KEY (`librarian_id`, `member_id`)
);
Add Table fined_transactions
---------------------------------------
`amount_added` VARCHAR(40),
`amount_received` VARCHAR(40),
`notes` VARCHAR(40),
`deleted` VARCHAR(40),
`created` VARCHAR(40),
`created_by` VARCHAR(40),
CONSTRAINT `PK_fined_transactions` PRIMARY KEY (`fined_transaction_id`)
);
Foreign key constraints
------------------------------
>ALTER TABLE `borrow_transaction` ADD CONSTRAINT `books_borrow_transaction`
FOREIGN KEY (`book_id`) REFERENCES `books` (`book_id`);
Following queries are used to insert, update and delete data from database(shown few queries only):
Saira Iqbal Page 18 of 19
INSERT INTO `author` (`author_id`, `first_name`, `last_name`) VALUES (2006, 'edoh', 'sanda');
SELECT member_name,member_type,gender
FROM members ORDER BY member_name DESC;
7.0 Conclusion
The main conclusion that can be drawn is therefore that using MySQL database system has been
designed for college library which can be used to store data regarding books, members of library and
can also update, delete and add new records.
This database is designed with that flexibility that it can be implemented in any library in future; it
can be modified easily into new technology. We can add as many data as required.
8.0 Recommendations
In the light of these conclusions, I recommend that database should be designed for every library.
We should established online library system by using this database design at backend
In addition, continue to investigate new languages for database design so that a better access to
database resources would be happen in future.
9.0 References
Entity Relationship diagram
URL: http://www.webopedia.com/TERM/E/entity_relationship_diagram.html [webopedia 2010]
Concepts on database
URL: http://www.dybowski.org/stm/cod [COD 2010]