0% found this document useful (0 votes)
64 views38 pages

Group 2 Library Management System

The document provides details about developing a Library Management System (LMS) including: 1) The objectives are to computerize the manual LMS process, make borrowing faster and more secure, provide a user-friendly system for members, reduce the librarian's workload, and prevent unauthorized access. 2) The scope includes analyzing the system, creating ER/EER diagrams, normalizing tables, implementing the database using SQL, and expressing queries. 3) Hardware and software requirements are listed to develop the LMS, including Windows 10, Intel Core i5 processor, 16GB storage, Microsoft Word, SQL Server 2012, and the Snipping Tool.

Uploaded by

hailsh72921
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views38 pages

Group 2 Library Management System

The document provides details about developing a Library Management System (LMS) including: 1) The objectives are to computerize the manual LMS process, make borrowing faster and more secure, provide a user-friendly system for members, reduce the librarian's workload, and prevent unauthorized access. 2) The scope includes analyzing the system, creating ER/EER diagrams, normalizing tables, implementing the database using SQL, and expressing queries. 3) Hardware and software requirements are listed to develop the LMS, including Windows 10, Intel Core i5 processor, 16GB storage, Microsoft Word, SQL Server 2012, and the Snipping Tool.

Uploaded by

hailsh72921
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 38

Contents

Acknowledgement........................................................................................................................................................................... 3
Introduction..................................................................................................................................................................................... 3
Background...................................................................................................................................................................................... 3
Objective of the project................................................................................................................................................................... 4
General objective.............................................................................................................................................................................. 4
Specific objective.............................................................................................................................................................................. 4
Scope of the Project......................................................................................................................................................................... 4
Hardware and Software Requirements used when we are doing this Project.................................................................................5
Description of the ER/EER Diagram (Analysis Phase).......................................................................................................................6
Design phase:................................................................................................................................................................................... 7
Entity Relationship Diagram (ERD/EERD) for Library Management System (LMS)...........................................................................7
Converting The ERD/EERD of LMS in to Table/Relation/Schema.....................................................................................................8
Functional Dependency................................................................................................................................................................... 9
Relational Schema Diagram/Functional Dependency for LMS logical tables...................................................................................9
Normalization:............................................................................................................................................................................... 11
1NF:................................................................................................................................................................................................ 11
2NF:................................................................................................................................................................................................ 11
3NF:................................................................................................................................................................................................ 12
Normalization Using sample records:............................................................................................................................................14
physical implementation of Library Management System.............................................................................................................16
SQL Code Implementation For LMS...............................................................................................................................................18
Physical Database Diagram for LMS obtained from SQL statement...............................................................................................33
SQL Statement for the Basic Query of LMS....................................................................................................................................33
Relational Algebra Expression for the basic queries......................................................................................................................37
Conclusion...................................................................................................................................................................................... 37

Hint!:use LMS initial instead of Library Management System.


Acknowledgement
we would like to express our deep gratitude for all thus who helped as while we
were doing our project and specifically we would like to thank our instructor
Abenezer Defar for giving as this course and sharing his knowledge with us .Then
we would like to thank BahirDar university institution of technology yibab campus
library members and librarians for giving us all the information we want. last but
not least we would like to thank our class mates and our seniors for helping us.

Introduction
Our project library management system mainly provide management functions
and other features are also included. The management functions include

✓ managing membership
✓ managing books
✓ managing the borrowing process of books which makes it easy for librarians
to managing effectively.
The other functions include

✓ maintaining the records of members.


✓ retrieving data about who borrowed books
✓ members can search for books them selves

Background
This project was implemented for Bahir Dar university Yibab campus Library, but
the project works for all university library systems. The current existing system in
yibab campus library is manual, exhaustive and uncomputerized system before we
decide to do this system, we had to analyze what was wrong and missing in the
currently existing system then we got the following draw backs.

✓ the existing system was manual


✓ the process of borrowing book was exhaustive
✓ members were unable to check if the book they want is available them
selves

2
✓ the existing system requires members to have a paper id
✓ the system is not secure for borrowing book
✓ The speed of searching books is not quick
✓ The librarians work manually so it is not accurate they may made mistake
during borrowing.

Objective of the project


General objective
The general objective if our project is to replace the manual and exhaustive library
management process with computerized database system and reduce time
wastage in borrowing and checking books and reduce human power.
Specific objective
➢ making the borrowing process fast and secure
➢ providing members (user) friendly library system
➢ reducing the work load of the librarian
➢ making effective book management system
➢ preventing unauthorized access to books and library

Scope of the Project


In our project we include the following Information’s:

❖ Analyzing the general ideas of the system like describing the nature of ER
/EER diagram of the system using informal language.
❖ Give or draw ER/EER_diagrams of the system based on the given information
gathered from analysis phase.
❖ Converting the ER/EER diagram in to table and Normalization
❖ Creating table using sql statement and Inserting a record in to a database on
the given information.
❖ Deleting and updating a record from a database using sql statement.
❖ Show the Physical database Diagram.
❖ Expressing queries using relational algebra.

3
❖ In the Library Management(proposed)System, we handle three main entities
as Librarian, Members and Books.
❖ We express the following basic query as example:
1) List Id, Fname, Lname, gender, Salary and working time of librarian that
works above 3 hours.
2) List Id, title, num_of_copy, edition_year of each book.
3) List all students whose department is Software Engineering and whose year is
2nd.
4) Delete book whose status is bad.
5) List the name of the Author for each book
6) List id, FName, Lname, gender, age and department of member who borrows
book and borrowed book name.
7) List all books that the edition_number is after 2015.
8) List the total number of books stored in each shelf
9) List Id, Fname, Lname of librarian that grants book and book name they grant
and member id, FName, Lname, Department, gender that granted by librarian
in book borrow process.
10) List all books that stored in shelf number 3.
11) List id, FName, LName, gender, age and salary of Librarian whose salary is
above 3000 birrs.

Hardware and Software Requirements used when we are doing this Project
➢ Operating system: window 10 pro

➢ Processor: Pentium(R) Dual-core CPU core i5

➢ 16GB Flash

➢ Microsoft word 2016

➢ SQL server 2012

➢ Snipping Tool

4
Description of the ER/EER Diagram (Analysis Phase)
This library management system has different participants and relationships
among them. Generally, this can be described as the following.
LIBRARIAN
Attributes (Name, gender, working time, address, age, salary,Phone_num,ID(unique))

BOOK this entity is identified by a bookID which is unique for each book, a number
of copies, number of currently available books, the status of the book, title,
edition number, edition year, the number of reserved books.
MEMBERS
Attributes (MID,Name,gender,phone_num).
There are two types of members they are employee and student.
AUTHOR
Attributes (Name,address,phone_num,author ID).
PUBLISHER
Attributes (address ,phone_num,Pub_name ).
SHELF is identified by shelf number which is unique for each shelf and shelf name.
on a self-book are stored.
Design phase:
Converting the requirements of the System in the analysis phase to ER/EER
diagram.

Entity Relationship Diagram (ERD/EERD) for Library Management System (LMS)

5
Converting The ERD/EERD of LMS in to Table/Relation/Schema

bookId title Num_of_copy edition_year Edition_num Num_of_currently Num_of_out Status pubName* shelfNum*
tly_available ut_Books
Book Table

Shelf Table
shelfNum ShelfName capacity
Shelf_Book Table

6
ShelfNum* bookId*

Author Table
auId FName LName City Kebele
Tellephone Table
auId Phon_num

Book_Author Table

BookId* auId*
Publisher Table
pubName city kebele
Tellephone Table
pubName Phon_num

Librarian Table
lbId FName LName password Gender age salary city kebele working_Time
Telephone Table
lbId Phon_num

Member table
membId FName LName Password gender age department city kebele

Tellphone Table
Membid Phon_num

Student Table

7
membId* Year

Employee Table
membId* salary

Borrows Table

membId* Bor_date Return_date


Grant_book Table
lbId* membId*

Functional Dependency
➢ Title,num_of_copy,edition_year,edition_number,num_currently_available,
num_of_out_books,status are fully depend on the prime attribute(bookId).
{bookId}-> {Title, num_of_copy, edition_year, edition_number, num_currently_available,

num_of_out_books, status}

➢ FName, LName, city, kebele, phon_num in author table fully depend on the
prime attribute (auId).
{auId-> {FName, LName, city, kebele, phon_num}

➢ City, kebele and phon_num in publisher table fully depend on the prime
attribute(pubName).
{pubName}-> { City, kebele and phon_num}

➢ FName, LName, gender, age, salary, city, kebele, phon_num and


working_time in the librarian table fully depend the Prime attribute(lbId).
{lbId}-> {FName, LName, gender, age, salary, city, kebele, phon_num working_time}

➢ FName, LName, gender, age, department, city, kebele and phon_num in


the member table fully depends on the prime attribute(membId).

Relational Schema Diagram/Functional Dependency for LMS logical tables

8
9
Grant_book Table
lbId* membId*

Normalization:
• is the process of identifying the logical associations between data items
and designing a database that will represent such associations but
without suffering the update anomalies.
• is a process of representing data in a minimal set of attributes and
minimize redundancy.
• Has six normal forms the basic one are 1NF,2NF and 3NF .
1NF:
• Disallow multivalued attribute
• All attributes depend on the prime key of the table
• Disallow composite attribute
2NF:
✓ A relation schema R is in second normal form (2NF) if it is in 1NF and
every non-prime attribute in relation is fully functionally dependent on
the primary key.
✓ Disallow partial dependency in the table 3NF:

10
3NF:
A relation R is in third normal form (3NF) if it is in 2NF and no nonprime
attribute in a relation is transitively dependent on the primary key. Book
Table

Since there is no multivalued attribute in the book table and all attributes depends
on the prime attribute i.e no partial dependency and also no transitive
dependency in the book table .so it satisfies 1NF,2NF,3NF. Shelf Table
Shelf Table
shelfNum ShelfName capacity
Since there is no multivalued attribute in the Shelf table and all attributes depends
on the prime attribute i. e no partial dependency and also no transitive
dependency .so it satisfies 1NF,2NF,3NF.

bookId title Num_of_copy edition_year Edition_num Num_of_currently Num_of_out Status pubName* shelfNum*
tly_available ut_Books
Unnormalized Author Table
auId FName LName City Kebele Phon_num

There is multivalued attribute(phon_num) in the Author table, it does not satisfy


1NF and all attributes depends on the prime attribute i. e no partial dependency
and also no transitive dependency .so it satisfies 2NF, 3NF.we can apply 1NF as
follows. Author
auId FName LName City Kebele
Author_phone
auId* Phon_num

This table satisfies 1NF,2NF and 3NF normalization rule.

Unnormalized Publisher Table

pubName City kebele Phon_num


There are multivalued attribute(phon_num) in the
Publisher table, it does not satisfy 1NF and all attributes depends on the prime
attribute(pubName) i. e no partial dependency and also no transitive dependency .so it
satisfies 2NF, 3NF.we can apply 1NF as follows.
11
Publisher
pubName city Kebele

publisher_phone
pubName* Phon_num
This table satisfies 1NF,2NF and 3NF normalization rule.

Author_Book
BookId* auId*
Since there are no multivalued attribute in the Author_Book table and all
attributes in the table depends on the combination of the two foreign key prime
attributes i. e no partial dependency and also no transitive dependency .so it
satisfies 1NF,2NF,3NF.

Unnormalized Librarian Table


lbId FName LName password gender age salary city kebele Phon_num working_time

There are multivalued attribute ( phon_num) in the Librarian table ,it does not
satisfy 1NF and all attributes depends on the prime attribute(lbId) i.e no partial
dependency and also no transitive dependency .so it satisfies 2NF,3NF.we can
apply 1NF as follows.
Librarian
lbId FName LName password gender age salary city kebele working_Time

Librarian_phone
lbId* Phon_num

Librarian, Librarian_phone satisfies 1NF,2NF and 3NF.


Unnormalized member Table
membId FName LName password gender age department city kebele Phon_num

12
There are multivalued attribute ( phon_num) in the member Table,it does not
satisfy 1NF and all attributes depends on the prime attribute(membId) i.e no
partial dependency and also no transitive dependency in the table.so it satisfies
2NF,3NF.we can apply 1NF as follows. member
membId FName LName Password gender age department city kebele

member_phone
membId* Phon_num
member, member_phone satisfies 1NF,2NF and 3NF.

Normalization Using sample records:


Unnormalized Librarian_Book Table
lbId FName LName gender Phon_num bookId title edYear edNum
L1100 Nahom Alazar Male 0923455,093645 B200 Java 2016 9th
L1101 Alias Debeb Male 0934556 B201 Database 2016 6th
L1102 Aster Aweke Female 0936475,093425 B203 Software 2017 7th
L1103 Mistre Melaku Female 0934568,0934563 B204 Applied 2018 11th
L1104 Afomia Chala Female 0937475 B205 Emego 2015 3rd
lbId-> (Fname, Lname, gender, phon_num) bookId->
(title, edYear, edNum)
In the Librarian_Book Table there is a multivalued attribute phon_num.so it does
not satisfy 1Nf normalization rule, to make the above table in to 1 st Normal form,
we can either flattened the table or decompose the multivalued attribute in to
another table by passing the
a prime attribute(lbId) as a foreign key.so by decompose the table we can change
the Librarian_Book Table to 1NF as follows:
1NF:
Librarian _Book Table
lbId FName LName gender bookId title edYear edNum
L1100 Nahom Alazar Male B200 Java 2016 9th
L1101 Alias Debeb Male B201 Database 2016 6th

13
L1102 Aster Aweke Female B203 Software 2017 7th
L1103 Mistre Melaku Female B204 Applied 2018 11th
L1104 Afomia Chala Female B205 Emego 2015 3rd

Librarian_phone table
lbId* Phon_num
L1100 0923455
L1100 093645
L1101 0934556
L1102 0936475
L1102 093425
L1103 0934568
L1103 0934563
L1104 0937475
Since in the Librarian_phone Table there is no multivalued or composite attribute
, so it satisfies 1NF.There is a partial functional dependency in the
Librarian_phone Table Fname, LName, gender and phon_num depend on the
prime attribute lbId and title, edYear, edNum depend on the prime attribute
bookId, so it does not satisfy 2Nf.Then to change this table in to 2NF, we can
decompose the table in to two parts.
2NF:
Librarian Table
lbId FName LName gender
L1100 Nahom Alazar Male
L1101 Alias Debeb Male
L1102 Aster Aweke Female
L1103 Mistre Melaku Female
L1104 Afomia Chala Female

Book Table
bookId Title edYear edNum

B200 Java 2016 9th

14
B201 Database 2016 6th
B203 Software 2017 7th
B204 Applied 2018 11th
B205 Emego 2015 3rd

The above tables satisfy 1NF, since no multivalued attribute (column) in the
table,2NF,since no partial functional dependency in the table and all columns
depend on the prime attribute of the table in each table. There is no transitive
dependency in the above table so it satisfies 3NF.

physical implementation of Library Management System


Physical Table design for Base Relations
Book Table
Column name data type Constraint length Not null

BookId varchar pk 10 yes


Title varchar _ 20 yes
Edition_Year int _ _ yes
Edition_Num int _ _ yes
Num_of_copy int _ _ yes
Num_of_out_Books int _ _ yes

Num_of_currently_available int _ _ no
Status varchar _ 20 yes

Author Table
Column name Data type constraint length Not null

Aid varchar pk 10 Yes

Fname varchar _ 20 Yes

Lname varchar _ 20 Yes

city varchar _ 20 Yes

kebele varchar - 20 yes


Phon_num int - - yes

15
Librarian Table
Column name Data type constraint length Not null
lbId varchar pk 10 Yes
Fname varchar _ 20 Yes
Lname varchar _ 20 Yes
password varchar default 20 no
age int - - yes
Salary float _ _ No
Working time int _ _ Yes
gender varchar _ 5 Yes
city varchar _ 20 Yes
kebele varchar - 20 yes
Phon_num int - - yes

Publisher table
Column name Data type constraint length Not null
pubName varchar pk 10 Yes
city varchar _ 20 Yes
Kebele Varchar _ 20 Yes
Phon_num int _ - Yes

Shelf table
Column name Data type constraint length Not null
shelfNum int pk - Yes
Shelf name varchar _ 20 Yes
capacity int - - yes
Member table
Column name Data type constraint length Not null

16
membId varchar pk 10 Yes
Lname varchar _ 20 Yes
Fname Varchar _ 20 Yes
password varchar default 20 yes
gender varchar check 5 Yes
department varchar _ 20 Yes
age int - - yes
city varchar - 20 yes
kebele varchar - 20 yess

Borrows table
Column name Data type constraint length Not null
BookId* varchar fk 10 Yes
membId* varchar fk 10 yes
Bor_date int _ _ No
Return_date int _ _ No

Checks table
Column name Data type constraint length Not null
bookId* varchar fk 10 Yes
lbId* varchar fk 10 Yes

SQL Code Implementation For LMS

create database library system


---------------------------------------------- use
library system
----------------------------------------------
/**creating tables */ /*1creating
librarian table*/ create table librarian(
lbId varchar(10)constraint lbpk primary
key(lbId), FName varchar(20) not null, LName
varchar(20),
password varchar(20) default('Lb123'),

17
gender varchar(5) constraint ch_gen check(gender in('M','F')),
age int, salary float, working_time int, city varchar(20),
kebele varchar(20)
)
--------------------------------------------------
/*2creating librarian_phone table*/ create table
librarian_phone(
lbId varchar(10)constraint lpfk foreign key(lbId)
references librarian(lbId) on update cascade on delete
cascade,
phon_num int unique(phon_num)
)
----------------------------------------------------
/*3creating library user/member table*/ create table
member(
membId varchar(10) constraint mpk primary
key(membId), FName varchar(20) not null, LName
varchar(20),
password varchar(20) default('mem456'),
gender varchar(5) constraint ch_mgen check(gender in('M','F')), age
int,
department varchar(20), city
varchar(20) ,
kebele varchar(20)
)
------------------------------------------------------
/*4creatin member_phone table*/ create table
member_phone(
membId varchar(10)constraint mpfk foreign key(membId)
references member(membId) on update cascade on delete cascade,
phon_num int unique(phon_num)
)
----------------------------------------
/*5creating employee table*/ create table
employee(
membId varchar(10) primary key constraint efk foreign key
(membId)references member(membId) on
update cascade on delete cascade,
salary float,
)
-------------------------------------------
/*6creating student table*/ create table
student(
membId varchar(10) primary key constraint sfk foreign key

18
(membId)references member(membId) on
update cascade on delete cascade,
year varchar(10),
)
----------------------------------------------
/*7creating shelf table*/ create table
shelf(
shelfNum int primary key not null,
shelfName varchar(50), capacity int
not null
)
---------------------------------------------
/*8creating publisher table*/ create table
publisher (
pubName varchar(20) primary key not null,
city varchar(20), kebele varchar(20)
)
---------------------------------------------
/*9creating publisher_phone table*/ create table
publisher_phone( pubName varchar(20) constraint pfk
foreign key(pubName) references publisher(pubName) on
update cascade on delete cascade,
phon_num int unique(phon_num)
)
------------------------------------------------
/*10creating author table*/ create table
author(
auId varchar(10),constraint apk primary key(auId),
FName varchar(20) not null, LName
varchar(20), city varchar(20),
kebele
varchar(20)
)
-----------------------------------------------
/*11creating author_phone table*/ create table
author_phone(
auId varchar(10) constraint afk foreign key(auId) references
author(auId) on update cascade on delete cascade, phon_num
int
)
-----------------------------------------------
/*12creating book table*/ create table
book(
bookId varchar(10) constraint bpk primary key(bookId),
title varchar(20) not null, edition_year int,
edition_num varchar(10), num_of_copy int,
19
num_of_out_book int, num_currently_available int,
status varchar(20),
pubName varchar(20) constraint bfk1 foreign key(pubName)
references publisher(pubName) on update cascade on
delete cascade,
)
-------------------------------------------------
/*13creating book_author table*/ create
table book_author(
bookId varchar(10) constraint bafk1 foreign key(bookId)
references book(bookId) on update cascade on delete
cascade,
auId varchar(10) constraint bafk2 foreign key(auId) references
author(auId) on update cascade on delete cascade
)
---------------------------------------------
/*14 creating book_shelf table*/
create table book_shelf(bookId varchar(10)constraint bsfk1
foreign key(bookId) references book(bookId),
shelfNum int constraint bsfk2 foreign key(shelfNum) references
shelf(shelfNum)
)
---------------------------------------------
/*15 creating borrows table*/ create table
borrows(
membId varchar(10) unique(membId) constraint brfk1 foreign
key(membId) references member(membId) on update cascade on
delete cascade,
bookId varchar(10) constraint brfk2 foreign
key(bookId) references book(bookId) on update cascade
on delete cascade, bor_date date,
return_date date
)
------------------------------------------------
/*16 creating checks table*/ create table
checks(
lbId varchar(10) constraint chfk1 foreign key(lbId) references
librarian(lbId) on update cascade on delete cascade, bookId
varchar(10) constraint chfk2 foreign key(bookId) references
book(bookId) on update cascade on
delete cascade
)
--------------------------------------- /*17
creating grant_book table*/ create table
grant_book(

20
lbId varchar(10) constraint grfk1 foreign key(lbId) references
librarian(lbId) on update cascade on delete cascade, membId
varchar(10) constraint grfk2 foreign key(membId) references
member(membId) on update cascade on delete cascade
)
-----------------------------------------------
/**inserting records for each table*/
--------------------------------------------
----------
/* inserting records for Librarian table*/
/*1*/insert into librarian
values('L1100','Nahome','Alazar','Lb123','M',27,5000,6,'Bahir
Dar','K14')
/*2*/insert into librarian
values('L1101','Alias','Debebe','Lb123','M',25,4000,4,'Debere
Tabor','K3')
/*3*/insert into librarian
values('L1102','Aster','Aweke','Lb123','F',23,2500,6,'Debre
Markos','K5')
/*4*/insert into librarian
values('L1103','Mistre','Melaku','Lb123','F',25,3500,3,'Bahir
Dar','K13')
/*5*/insert into librarian
values('L1104','Yordanos','Abebaw','Lb123','F',22,3000,3,'Bahir
Dar','K8')
/*6*/insert into librarian
values('L1105','Degarege','Lesew','Lb123','M',26,3500,4,'Finote
Selam','K4')
/*7*/insert into librarian
values('L1106','Maregu','Amare','Lb123','M',28,3800,5,'Gonder','
K8')
/*8*/insert into librarian
values('L1107','Afomia','Chala','Lb123','F',26,3300,4,'Adama','K
2')
/*9*/insert into librarian
values('L1108','Mohamed','Yonas','Lb123','M',29,4600,7,'Dessie',
'K1')
/*10*/insert into librarian
values('L1109','Eyerus','Melaku','Lb123','F',25,3700,4,'Piaza','
K7') select *from librarian

21
-----------------------------------------------------
/*inserting records for librarian_phone*/
/*1*/insert into librarian_phone values('L1100',0922110)
/*2*/insert into librarian_phone values('L1101',0934110)
/*3*/insert into librarian_phone values('L1102',094511078)
/*4*/insert into librarian_phone values('L1103',0925611090)
/*5*/insert into librarian_phone values('L1104',0929011056)
/*6*/insert into librarian_phone values('L1105',0922341013)
/*7*/insert into librarian_phone values('L1106',0922189089)
/*8*/insert into librarian_phone values('L1107',0922110678)
/*9*/insert into librarian_phone values('L1108',0922112343)
/*10*/insert into librarian_phone values('L1109',0912321100)
select *from librarian_phone

--------------------------------------------
/*inserting record for member table*/
/*1*/insert into member
values('m001','Dawit','Zenebe','mem456','M',22,'Software','Bahir
Dar','K16')
/*2*/insert into member
22
values('m002','Zertu','Kebede','mem456','f',20,'Computer
Science','Bahir Dar','k7') /*3*/insert into member
values('m003','Tesema','zenaw','mem456','M',27,'Is','Bahir
Dar','K5')
/*4*/insert into member
values('m004','Yeshitila','Yihun','mem456','M',46,'Secriterial
science','Bahir Dar','K2') /*5*/insert into member
values('m005','Mulugeta','Mola','mem456','M',23,'Civil','Bahir
Dar','K6')
/*6*/insert into member
values('m006','Mahilet','abebe','mem456','f',25,'Electrical','Ba
hir Dar','K12') /*7*/insert into member
values('m007','Aster','Zenebe','mem456','f',23,'Software','Bahir
Dar','K5')
/*8*/insert into member
values('m008','Zebene','Tarkegn','mem456','M',28,'Software','Bah
ir Dar','K13') /*9*/insert into member
values('m009','Mulu','Tarkegn','mem456','f',35,'Janitor','Bahir
Dar','K3')
/*10*/insert into member
values('m011','Mola','Asnake','mem456','M',25,'Law','Bahir
Dar','K12') select *from member

------------------------------------------------------
/*inserting record for member_phone table*/
/*1*/insert into member_phone values('m001',091243646)
/*2*/insert into member_phone values('m002',0967567654)
/*3*/insert into member_phone values('m003',0935455695)
/*4*/insert into member_phone values('m004',0935428972)
/*5*/insert into member_phone values('m005',0912466463)
/*6*/insert into member_phone values('m006',0962436469)
/*7*/insert into member_phone values('m007',0972436468)
/*8*/insert into member_phone values('m008',0992436467)
/*9*/insert into member_phone values('m009',0912436464)
23
/*10*/insert into member_phone values('m011',0912436463)
select *from member_phone

--------------------------------------------
/*inserting records for employee table*/
/*1*/insert into employee values('m004',4000)
/*2*/insert into employee values('m009',6000) select
*from employee

--------------------------------------------
/*inserting records for student table*/
/*1*/insert into student values('m001','2nd')
/*2*/insert into student values('m002','2nd')
/*3*/insert into student values('m003','1st')
/*4*/insert into student values('m005','3rd')
/*5*/insert into student values('m006','1st')
/*6*/insert into student values('m007','2nd') /*7*/insert into
student values('m008','2nd') /*8*/insert into student
values('m011','4th') select *from student

24
-------------------------------------------------
/*inserting records for shelf table*/
/*1*/insert into shelf values(01,'Software_books',20)
/*2*/insert into shelf values(02,'Database_books',18)
/*3*/insert into shelf values(03,'Programming_books',17)
/*4*/insert into shelf values(04,'Applied_books',40)
/*5*/insert into shelf values(05,'Investment_books',33)
/*6*/insert into shelf values(06,'Law_books',45)
/*7*/insert into shelf values(07,'engineering_books',28)
/*8*/insert into shelf values(08,'Fiction',39)
/*9*/insert into shelf values(09,'philosophy',50)
/*10*/insert into shelf values(11,'Land_books',70) select
*from shelf

-----------------------------------------------------
/*inserting records for publisher table*/
/*1*/insert into publisher values('Alan R.Apt','Atalanta','st7')
/*2*/insert into publisher values('Mega','Arada','k5')
/*3*/insert into publisher values('Kuraz','Bahir Dar','k3')
/*4*/insert into publisher values('Dengel','Bahir Dar','k3')
/*5*/insert into publisher values('Aster nega','Bole','ketena5')
25
/*6*/insert into publisher values
('Adison_Wesley','Boston','st.jorge')
/*7*/insert into publisher values('Tana','Bahir Dar','k10')
/*8*/insert into publisher values('Lion','Addis Ababa'
,'Legehar')
/*9*/insert into publisher values('prentice Hall' ,'Washington'
,'st.Jhon')
/*10*/insert into publisher values('McGraw_Hill','San francisko'
,'st.louis') select
*from publisher

--------------------------------------------------
/*Inserting records for publisher_phone*/
/*1*/insert into publisher_phone values('Mega',0923445675)
/*2*/insert into publisher_phone values('Kuraz',0934567845)
/*3*/insert into publisher_phone values('Dengel',0904546098)
/*4*/insert into publisher_phone values('Aster nega',0921234567)
/*5*/insert into publisher_phone values('Alan R.Apt',1209456456)
/*6*/insert into publisher_phone values('Adison_Wesely' ,
312345097)
/*7*/insert into publisher_phone values('Tana',0918234567)
/*8*/insert into publisher_phone values('Lion',0911564567)
/*9*/insert into publisher_phone values('prentice Hall',
16453429)
/*10*/insert into publisher_phone values('McGraw_Hill',
922287456)
select *from publisher_phone

26
------------------------------------------------
/*Inserting records in to Author*/
/*1*/insert into author
values('a1200','Danial','Liang','Atlanta','st.Jhone')
/*2*/insert into author values('a1201', 'Ramez','Elmasri' ,
'Gorgia','st.Jorge')
/*3*/insert into author values('a1202', 'Behrouz','A.Forouzan'
,'New York','st.Paul')
/*4*/insert into author values('a1203','Sophia Chung', 'Fegan',
'New York','st.Paul') /*5*/insert into author
values('a1204','Bahilu','Girma','Addis
Ababa','Bole')
/*6*/insert into author values('a1205','Begashaw','Moltot',
'Bahir Dar','K14')
/*7*/insert into author values('a1206','Alemayew','Wase','Bahir
Dar','k13')
/*8*/insert into author values('a1207','Daniel','Kibiret','Addis
Ababa','kirkos')
/*9*/insert into author values('a1208','Desalew','Mesfin','Bahir
Dar','k10')
/*10*/insert into author
values('a1209','Roger','S.pressMan','New York','NY 10020')
select *from author

27
-------------------------------------------------------
/*Inserting records for author_phone*/
/*1*/insert into author_phone values('a1200',345123402)
/*2*/insert into author_phone values('a1201',19546789)
/*3*/insert into author_phone values('a1202',654120348)
/*4*/insert into author_phone values('a1203',112345208)
/*5*/insert into author_phone values('a1204',0909456456)
/*6*/insert into author_phone values('a1205',0912094759)
/*7*/insert into author_phone values('a1206',0920234567)
/*8*/insert into author_phone values('a1207',0911564567)
/*9*/insert into author_phone values('a1208',0911092354)
/*10*/insert into author_phone values('a1209',4509765) select
*from author_phone

---------------------------------------------------
/*Inserting records for book table*/
/*1*/insert into book values('b200','Introduction to
Java',2015,'9th',10,5,5,'Good','prentice Hall')
/*2*/insert into book values('b201','Database',2016,'6th',22,
3,19,'Good','Adison_Wesely')
28
/*3*/insert into book values('b202','Networking',2012,'4th',17,8
,9,'Good','McGraw_Hill') /*4*/insert into
book
values('b203','Soft.Enginnering',2016,'7th',15,4,11,'Normal','Mc
Graw_Hill')
/*5*/insert into book values('b204','Applied lll',2018,'11th'
,30,10,20,'Good','Tana')
/*6*/insert into book values('b205','Oromay',2008,'5th',9,2
,7,'Good','Lion')
/*7*/insert into book values('b206','Ye A.A wushoch',2019,'1st'
,12,8,4,'Good','Lion')
/*8*/insert into book values('b207','Emegua',2015,'3th',13,7,6,
'Good','Dengel') /*9*/insert into
book
values('b208','Civics',2017,'4th',80,30,50,'Good','Aster nega')
/*10*/insert into book values('b209','Daynamics',2013,'8th',43,
10,35,'Good','Mega') /*11*/insert into
book
values('b211','investiment',2014,'11th',60,10,50,'Good','Kuraz')
--truncate table book select
*from book

-----------------------------------------------------
/*inserting records for book_author table*/
/*1*/insert into book_author values('b200','a1200')
/*2*/insert into book_author values('b201','a1201')
/*3*/insert into book_author values('b202','a1202')
/*4*/insert into book_author values('b202','a1203')
/*5*/insert into book_author values('b203','a1209')
/*6*/insert into book_author values('b204','a1205')
/*7*/insert into book_author values('b205','a1204')
/*8*/insert into book_author values('b206','a1207')
/*9*/insert into book_author values('b207','a1206')
/*10*/insert into book_author values('b208','a1208') select
*from book_author
29
---------------------------------------------------
/*inserting records for book_shelf table*/
/*1*/insert into book_shelf values('b203',01)
/*2*/insert into book_shelf values('b201',02)
/*3*/insert into book_shelf values('b200',03)
/*4*/insert into book_shelf values('b202',03)
/*5*/insert into book_shelf values('b204',04)
/*6*/insert into book_shelf values('b211',05)
/*7*/insert into book_shelf values('b208',06)
/*8*/insert into book_shelf values('b209',07)
/*9*/insert into book_shelf values('b205',08)
/*10*/insert into book_shelf values('b207',09)
/*11*/insert into book_shelf values('b205',08)
/*12*/insert into book_shelf values('b206',09)
/*13*/insert into book_shelf values('b211',11) select
*from book_shelf

30
---------------------------------------------------
/*inserting records for borrows table*/
/*1*/insert into borrows values('m001','b203','01-082011','0508-
2011')
/*2*/insert into borrows values('m002','b202','02-09-
2011','0809-2011')
/*3*/insert into borrows values('m003','b203','03-07-2011','09-
07-2011')
/*4*/insert into borrows
values('m004','b206','01/08/2011','05/08/2011')
/*5*/insert into borrows values('m005','b204','01/09/2011',
'05/09/2011')
/*6*/insert into borrows values('m006','b209','01/08/2011',
'08/08/2011')
/*7*/insert into borrows values('m007','b201','01/08/2011',
'05/08/2011')
/*8*/insert into borrows values('m008','b200','07/05/2011',
'09/05/2011')
/*9*/insert into borrows values('m009','b207','05/08/2011',
'09/09/2011')
/*10*/insert into borrows values('m011','b211','02/09/2011',
'07/09/2011')
--truncate table borrows select
*from borrows

---------------------------------------------------
/*inserting records for checks table*/
/*1*/insert into checks values('L1100','b203')
/*2*/insert into checks values('L1100','b207')
/*3*/insert into checks values('L1102','b200')
/*4*/insert into checks values('L1103','b206')
/*5*/insert into checks values('L1104','b201')
/*6*/insert into checks values('L1105','b202')
31
/*7*/insert into checks values('L1106','b204')
/*8*/insert into checks values('L1107','b208')
/*9*/insert into checks values('L1108','b205')
/*10*/insert into checks values('L1109','b209') select
*from checks

-------------------------------------------------------
/*inserting records for grant_book table*/
/*1*/insert into grant_book values('L1100','m001')
/*2*/insert into grant_book values('L1100','m002')
/*3*/insert into grant_book values('L1101','m003')
/*4*/insert into grant_book values('L1102','m004')
/*5*/insert into grant_book values('L1103','m005') /*6*/insert
into grant_book values('L1104','m006')
/*7*/insert into grant_book values('L1105','m007')
/*8*/insert into grant_book values('L1106','m009')
/*9*/insert into grant_book values('L1107','m011') select
*from grant_book

32
Physical Database Diagram for LMS obtained from SQL statement

SQL Statement for the Basic Query of LMS


/*query1 list librarian info whose working time greater than 3 hour*/
select lbId,fName,LName,gender,salary,working_time from librarian
where working_time>3

33
<-Output

/*query2*/ select
bookId,title,num_of_copy,edition_year from book

/*query 3*/ select


*from member m inner
join student s
on ( m.membId=s.membId) and (m.department='software' and
s.year='2nd')

/*query 5*/ select b.title as Book,a.Fname+' '+a.Lname as Author


from book b, author a,book_author ba where (ba.auId=a.auId and
ba.bookId=b.bookId)

34
/*query 6*/ select m.membId,m.FName+'
'+m.LName as
Name,m.gender,m.age,m.department,b.title as Book from member m
,Book b,borrows br where(br.membId=m.membId and
br.bookId=b.bookId)

/*query 7*/ select


*from book where
edition_year>=201
5

/*query 8*/ select sh.shelfName,COUNT(b.bookId) as


TotalNum_of_Book from shelf sh ,book_shelf bsh,book b
where(bsh.bookId=b.bookId and bsh.shelfNum=sh.shelfNum) group
by shelfName

35
/*query 9*/ select b.bookId, b.title as book,l.lbId,l.FName+'
'+l.LName as
GrantLibrarianName, m.membId,
m.FName+' '+m.Lname as BorrowerName,m.gender,
m.department, br.bor_date, br.return_date from
librarian l
,borrows br, book b,grant_book gr,member m
where(br.bookId=b.bookId and br.membId=m.membId)
and(gr.lbId=l.lbId and m.membId=gr.membId)

/*query 10*/ select title as Books_Stored_in_Shelf_Num3 from


shelf sh,book b,book_shelf bs where
(bs.bookId=b.bookId and bs.shelfNum=sh.shelfNum)and
sh.shelfNum=3

/*query 11*/ select lbId,FName,LName,gender,age,salary from


librarian where salary>3500

36
Relational Algebra Expression for the basic queries
Query 1: Result1σ working time>=3(Librarian)

Result π Id, Fname, Lname, gender, Salary,workingtime(Result1).

Query 2: π Id, title, num_of_copy, edition_year ( book).

Query 3: σ (m.membId=s.membId and m.department='software' and

s.year='2nd')(student s member m)

Query5: Result4σ (ba. auId=a.auId and ) (author a X book b X book_author


ba. bookId=b.bookId

ba)
Result5πtitle, Fname, Lname (Result4)

Query6: Result6σ br.membId=m.membId and br.bookId=b.bookId(


member m X Book b X borrows br)
Result7π m.membId,m.Fname,m.LName
,m.gender,m.age,m.department,b.title(Result6) Query

7: σ edition_year>=2015(book).
Query11:Result8σsalary>3500(librarian)

Result9πlbId,FName,LName,gender,age,salary( Result8)
.

37
Conclusion
This project was present pragmatic change for the library management system. it
makes everything easier.
Since the whole thing in the library perform by using computer due to this
searching, borrowing and so on activities are perform within a fraction of minute
this reduce manual labor force or work and worn out of the book.

38

You might also like