A Project Report ON Library Management System: Niranjan KC Sagar Kunjyang Tamang Prajwal Bhandari

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 14

A

PROJECT REPORT

ON

LIBRARY MANAGEMENT SYSTEM

By

Niranjan KC
Sagar Kunjyang
Tamang
Prajwal Bhandari

Submitted to:

Mr. Arjun Rokaya

Nepal Commerce Campus

In partial fulfillment of the requirements for the Course


Database Management System

Min-Bhawan, Kathmandu

August 2019
Table of Contents
1. Introduction.............................................................................................................................1
1.1 Background......................................................................................................................1
1.2 Objectives........................................................................................................................ 1
2. Database Design and Development....................................................................................... 2
2.1 Database Design.............................................................................................................. 2
2.1.1 ER Diagram.............................................................................................................. 2
2.1.2 Schema Design......................................................................................................... 3
2.2 Database Development....................................................................................................3
2.2.1 Entity and Attributes Creation [DDL]...................................................................... 3
2.2.2 Anomalies and Normalization.................................................................................. 6
2.2.3 Integrity Constraint Management.............................................................................6
3. Database Testing....................................................................................................................7
3.1 Entry record in each table................................................................................................7
3.2 Updating, Deletion, Selection Records............................................................................8
3.2.1 Update records..........................................................................................................8
3.2.2 Delete the records..................................................................................................... 9
3.2.3 Selection Records..................................................................................................... 9
4. T-SQL..................................................................................................................................10
4.1 Simple Queries...............................................................................................................10
1........................................................................................................................................... 10
4.2 Subqueries......................................................................................................................10
1........................................................................................................................................... 10
4.3 Join.................................................................................................................................10
4.3.1 Inner join................................................................................................................10
4.3.2 Left join................................................................................................................. 11
4.3.3 Right join............................................................................................................... 11
4.3.4 Full outer join........................................................................................................ 11
5. Conclusion and Knowledge gained..................................................................................... 12
1. Introduction

1.1 Background
A library management system, also known as an automated library system is software that
has been developed to handle basic housekeeping functions of a library. It is an application
refers to other library system and it is suitable to use by small and medium size library. It
helps to provide information on any book present in library to the user as well as staff
member. It keeps a record of book issued, returned and added to library.

Ifbook issued, returned and added, records are carried out manually will be tedious and
includes chances of mistakes. These errors are avoided by allowing the system to keep track
of information such as issue date, last date to return the book and even fine information and
thus there is no need to keep manual track of this information which thereby avoids chances
of mistakes. Thus this system reduces manual work to a great extent which allows smooth
flow of library activities by removing chances of errors in the details.

1.2 Objectives
 To eliminate the paper work in library.
 To record every transection in computer system.
 To design a user friendly graphical user interface which suit the user.
 To save the cost and time.
 To allow user to reserve book online.

Page 1 of 14
2. Database Design and Development

2.1 Database Design


2.1.1 ER Diagram

Fig:ER-diagram
Here, the figure shows the er diagram which shows the relationship between the entities.

Primary key:

Book_id

Publisher_id

member_id

Page 2 of 14
2.1.2 Schema Design

Book Publisher
Book_id M 1 Publisher_id
Book_name Book_id
Publisher_id

M M
Publish_by
Book_id
Publisher_id

Return_by
issued_date
member_id

Issued to Members
member_id M member_id
book_id member_name
issued_date member_type

Fig: Schema design


Here, the fig shows the schema design and also the relationship between the entities.

2.2 Database Development


Library management deals with design that covers the information about the records of
members (students,teachers,staff), book issued, returned and added to library and so on. This
database is designed through SOL.

2.2.1 Entity and Attributes Creation [DDL]


Data Definition Language(DDL):Database language that is used to create,delete,or modify
database schema is called data definition language.DDL is used to define internal and
external schemas(views).
DDL Commands:
Create :use to create a table
Drop:use to delete table
Alter:use to modify data of table

Page 3 of 14
Rename:use to modify table name
Truncate: use to delete data from table
Entities and their Attributes are:
Member
member_id
member_name
member_type]

Book

book _id
book _name

Publisher

publisher_id
publisher_name
Book_publisher
book_id
publisher_id

Book_issued

member_id
book_id
issued_date

Book_return

member_id
book_id
return _date

Page 4 of 14
Creating Tables

--creating table for member

create table member


(
member_idint,
member_namevarchar(255),
member_typevarchar(10) check (member_type = 's' or member_type = 't'),
primary key (member_id),
);

--creating a table for book

create table book


(
book_idint,
book_namevarchar(255),
primary key(book_id),
);

--creating a table for publisher

create table publisher


(
publisher_idint,
publisher_namevarchar(255),
primary key(publisher_id)
);

-- creating table for book_publisher

create table book_publisher


(
book_idint,
publisher_idint,
foreign key(book_id) references book,
foreign key(publisher_id) references publisher
);

Page 5 of 14
--create table for book_issued

create table book_issued


(
member_idint,
book_idint,
issued_date date,
foreign key(member_id) references member,
foreign key(book_id) references book,
);

--creating table for returning date

create table book_return


(
member_idint,
book_idint,
return_date date,
foreign key(member_id) references member,
foreign key(book_id) references book,
);

2.2.2 Anomalies and Normalization


Anomalies are the simply error and inconsistency of the database. Anomalies are problems
that can occur in poorly planned, unnormalized database where all the data stored in one
table. There are especially three types of anomaly.
Insertion anomaly: It is the inability to add the data in the database.
Deletion anomaly: Some information is loss due to the deletion of other values.
Update anomaly: It can be occurred during the time of recording the data in one table causes
partial update or redundant.
Normalization is a process of organizing the data in database to avoid data redundancy,
insertion anomaly, update anomaly y and deletion anomaly. It maintains integrity and
consistency in the database. It is used in a database management system specifically with
relational database to decrease redundant information and to minimize the data anomaly.
After removing anomalies in database normalization occurs.
2.2.3 Integrity Constraint Management
Integrity constraint ensures the changes made to the database by the authorized user due to
the loss of database. It guards against the accidental damage to the database. It includes the
domain, referential assertion integrity. To create a table, we use NOT NULL, PRIMARY
KEY, UNIQUE, CHECK.

Page 6 of 14
Example:
create table book
(
book_idintnotnull,
book_namevarchar(255)notnull,
primary key(book_id),
);

Referential Integrity
create table book_issued
(
member_idint,
book_idint,
issued_date date,
foreign key(member_id) references member,
foreign key(book_id) references book,
);
3. Database Testing
To test database,we have used DML commands like insert,delete,update and select.Using
these commands we hav prepare queries and tested it.

3.1 Entry record in each table


--inserting a value in member table
insert into member (member_id,member_name,member_type) values (1,'Dipesh
Shrestha','s');
insert into member (member_id,member_name,member_type) values (2,'Chaandanee
Ceelpakaar','s');
insert into member (member_id,member_name,member_type) values (3,'Diwash
Dahal','s');
insert into member (member_id,member_name,member_type) values (4,'Manish
khadaka','t');
insert into member (member_id,member_name,member_type) values (5,'Krishna
khadaka','t');

--inserting a value in table book


insert into book (book_id,book_name) values (101,'Dbms');
insert into book (book_id,book_name) values (102,'Java');
insert into book (book_id,book_name) values (103,'Webtechnology');
insert into book (book_id,book_name) values (104,'Economics');
insert into book (book_id,book_name) values (105,'Accounting');

--inserting a value in table publisher


insert into publisher values(11,'Jonny sins');
insert into publisher values(12,'Huge Jackman');
insert into publisher values(13,'Jack Joneson');
insert into publisher values(14,'Jonny Deep');
insert into publisher values(15,'Daniel Radclif');
--inserting a value for book_publisher
insert into book_publisher (book_id,publisher_id) values (101,11);
insert into book_publisher (book_id,publisher_id) values (105,15);
Page 7 of 14
insert into book_publisher (book_id,publisher_id) values (102,12);
insert into book_publisher (book_id,publisher_id) values (103,14);
insert into book_publisher (book_id,publisher_id) values (104,13);
--inserting values in table book_issued
insert into book_issued(member_id,book_id,issued_date) values (1,101,'02-08-
2018');
insert into book_issued(member_id,book_id,issued_date) values (1,103,'10-08-
2018');
insert into book_issued(member_id,book_id,issued_date) values (2,102,'12-08-
2018');
insert into book_issued(member_id,book_id,issued_date) values (2,101,'01-09-
2018');
insert into book_issued(member_id,book_id,issued_date) values (3,104,'11-09-
2018');
insert into book_issued(member_id,book_id,issued_date) values (3,105,'11-09-
2018');
--inserting in table book_return
insert into book_return(member_id,book_id,return_date) values (1,101,'11-09-
2018');
insert into book_return(member_id,book_id,return_date) values (1,103,'10-08-
2018');
insert into book_return(member_id,book_id,return_date) values (2,102,'11-10-
2018');
insert into book_return(member_id,book_id,return_date) values (2,101,'11-09-
2018');
insert into book_return(member_id,book_id,return_date) values (3,104,'11-10-
2018');

3.2 Updating, Deletion, Selection Records


3.2.1 Update records
1. Update the member name whose member_id is 3.
update member set member_name='Diwash bhandari'where member_id=3;

2. Update java book by C++.

update book set book_name='c++'where book_name='java';

Page 8 of 14
3.2.2 Delete the records
1. Delete the record of DBMS published by Jonny Sins.
Delete from book_publisher where book_id=101 and publisher_id=11;

2. Delete record where member_id=1 does not borrow the book_id= 103.
Delete from book_issued where member_id =1 and book_id=103;

3.2.3 Selection Records


1. Retrieve all records from member.
select*from member;

2. Retrieve all records from publisher.


select*from publisher;

3. Retrieve all records from book.


select*from book;

Page 9 of 14
4. T-SQL
4.1 Simple Queries
1. Find the members who are student.
select member_name from member where member_type='s';

2. Find the book name published by ‘Huge Jackman’.


select book.book_name from book,publisher,book_publisher where
book.book_id = book_publisher.book_id and book_publisher.publisher_id =
publisher.publisher_id and publisher.publisher_name='Huge Jackman';

4.2 Subqueries
1. Find the book borrowed by most of the student.
select b.book_name from book as b where b.book_id =(selecttop 1 book_id
from book_issued as bi groupby bi.book_id orderbyCOUNT(bi.book_id));

4.3 Join
4.3.1 Inner join
select book.book_name ,publisher.publisher_name from ((book innerjoin
book_publisher on book.book_id = book_publisher.book_id )innerjoin
publisher on book_publisher.publisher_id = publisher.publisher_id);

Page 10 of 14
4.3.2 Left join
select book.book_name ,publisher.publisher_name from ((book leftjoin
book_publisher on book.book_id = book_publisher.book_id )leftjoin publisher
on book_publisher.publisher_id = publisher.publisher_id);

4.3.3 Right join


select book.book_name ,publisher.publisher_name from ((book rightjoin
book_publisher on book.book_id = book_publisher.book_id )rightjoin
publisher on book_publisher.publisher_id = publisher.publisher_id);

4.3.4 Full outer join


select book.book_name ,publisher.publisher_name from ((book fullouterjoin
book_publisher on book.book_id = book_publisher.book_id )fullouterjoin
publisher on book_publisher.publisher_id = publisher.publisher_id);

Page 11 of 14
5. Conclusion and Knowledge gained
A library management system is software that keeps the complete records of the book
available in the library, book issued to whom and when, book returned date, new book added
to the library. We conclude that this system reduces manual work to a great extent which
allows smooth flow of library activities by removing chances of errors in the details.
We come to know about the importance of database design in library management system as
database design simplifies all the system and process in library management. Similarly, we
know about the way of solving data redundancy and inconsistency problem with the help of
database design. We gained knowledge about the importance of data integrity and how it can
be maintained in our management system with the help of database management system.
Database design helps us to store and retrieve the data in library management system so that
we can know who and when the book has been handover. Therefore, we can prepare our
library management system with the help of database design as it helps to achieve our
objectives i.e. to keep proper records of the library activities.So,with the help of these
management system we can easily find out the details of thebooks we need from the library.

Page 12 of 14

You might also like