0% found this document useful (0 votes)
19 views

Library Management System

Library management project
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Library Management System

Library management project
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 47

A Project Report

On
LIBRARY MANAGEMENT SYSTEM

For
AISSCE 2024 Examination
[As a part of the Computer Science Course (083)]

Submitted By

Name:
Board Roll No:

Under the Guidance of:


RAJ KUMAR (PGT Computer Science)

VIVEK VIDYALAYA
JAMSHEDPUR
CERTIFICATE

This is to certify that the Project entitled Library Management System

is a bonafide work done by Prem Tiwari of class XII ‘Science’ Session

2023-24 in partial fulfillment of CBSE AISSCE Examination 2024 and

has been carried out under my direct supervision and guidance. This

report or a similar report on the topic has not been submitted for any

other examination and does not form a part of any other course

undergone by the candidate.

…………………………………… ……………………………………
Signature of Student Signature of Teacher/Guide

Board Roll No:……………….. Designation: PGT (Comp. Sc.)

Place: Jamshedpur

Date:
ACKNOWLEDGMENT
I undertook this Project work, as the part of my XII-Computer Science
course. I had tried to apply my best of knowledge and experience,
gained during the study and class work experience. However,
developing software system is generally a quite complex and time-
consuming process. It requires a systematic study, insight vision and
professional approach during the design and development.
Moreover, the developer always feels the need, the help and good
wishes of the people near you, who have considerable experience
and idea.

I would like to extend my sincere thanks and gratitude to my teacher


Raj Kumar. I am very much thankful to our Principal Mr.
Awadhesh Singh for giving valuable time and moral support to
develop this software.

I would like to take the opportunity to extend my sincere thanks and


gratitude to my father Shri T. Vithoba Sakharam and my mother
Mrs. Sujata V for being a source of inspiration and providing time
and freedom to develop this software project.

I also feel indebted to my friends Sudarshan Pal and Bhupendra


Negi for the valuable suggestions during the project work.

Prem Tiwari
Class XII (Science)
CONTENT
1. Introduction

2. Theoretical Background

3. System Implementation

3.1 The Hardware used:

3.2 The Softwares used:

4. System Design & Development

4.1Database Design:

4.2 Menu Design:

5. User Manual

5.1 How to install:

5.2 Working with Software:

6. References
3.1 What is Database?
Introduction and Concepts:
A database is a collection of information related to a particular subject or
purpose, such as tracking customer orders or maintaining a music
collection. Using any RDBMS application software like MS SQL Server,
MySQL, Oracle, Sybase etc, you can manage all your information from a
single database file. Within the file, divide your data into separate storage
containers called tables. You may and retrieve the data using queries.

A table is a collection of data about a specific topic, such as products or


suppliers. Using a separate table for each topic means you can store that
data only once, which makes your database more efficient and reduces
data-entry errors. Table organises data into columns (called fields) and
rows (called records).

A Primary key is one or more fields whose value or values uniquely


identify each record in a table. In a relationship, a primary key is used to
refer to specific record in one table from another table. A primary key is
called foreign key when it is referred to from another table.

To find and retrieve just the data that meets conditions you specify,
including data from multiple tables, create a query. A query can also
update or delete multiple records at the same time, and perform built-in
or custom calculations on your data.

Role of RDBMS Application Program:


A computer database works as a electronic filing system, which has a
large number of ways of cross-referencing, and this allows the user many
different ways in which to re-organize and retrieve data. A database can
handle business inventory, accounting and filing and use the information
in its files to prepare summaries, estimates and other reports. The
management of data in a database system is done by means of a
general-purpose software package called a

Database Management System (DBMS). Some commercially available


DBMS are MS SQL Server, MS ACCESS, INGRES, ORACLE, and Sybase. A
database management system, therefore, is a combination of hardware
and software that can be used to set up and monitor a database, and can
manage the updating and retrieval of database that has been stored in it.
Most of the database management systems have the following
capabilities:

 Creating of a table, addition, deletion, modification of records.

 Retrieving data collectively or selectively.

 The data stored can be sorted or indexed at the user's discretion and
direction.

 Various reports can be produced from the system. These may be


either standardized report or that may be specifically generated
according to specific user definition.

 Mathematical functions can be performed and the data stored in the


database can be manipulated with these functions to perform the
desired calculations.

 To maintain data integrity and database use.

The DBMS interprets and processes users' requests to retrieve


information from a database. In most cases, a query request will have to
penetrate several layers of software in the DBMS and operating system
before the physical database can be accessed. The DBMS responds to a
query by invoking the appropriate subprograms, each of which performs
its special function to interpret the query, or to locate the desired data in
the database and present it in the desired order.
3.2 What is My SQL?
The management of data in a database system is done by means of a general-purpose
software package called a Database Management System (DBMS). Some commercially
available RDBMS are MS SQL Server, MS ACCESS, INGRES, ORACLE, and Sybase.

MySQL, the most popular Open Source SQL database management system, is developed,
distributed, and supported by Oracle Corporation. MySQL is named after co-founder Monty
Widenius's daughter, My. The name of the MySQL Dolphin (our logo) is “Sakila,”.

 MySQL is a database management system.


A database is a structured collection of data. It may be anything from a simple
shopping list to a picture gallery or the vast amounts of information in a corporate
network. To add, access, and process data stored in a computer database, you need a
database management system such as MySQL Server. Since computers are very good
at handling large amounts of data, database management systems play a central role in
computing, as standalone utilities, or as parts of other applications.
 MySQL is based on SQL.
A relational database stores data in separate tables rather than putting all the data in
one big storeroom. This adds speed and flexibility. The SQL part of “MySQL” stands
for “Structured Query Language.” SQL is the most common standardized language
used to access databases and is defined by the ANSI/ISO SQL Standard. The SQL
standard has been evolving since 1986 and several versions exist. In this manual,
“SQL-92” refers to the standard released in 1992, “SQL: 1999” refers to the standard
released in 1999, and “SQL: 2003” refers to the current version of the standard.
 MySQL software is Open Source.
Open Source means that it is possible for anyone to use and modify the software.
Anybody can download the MySQL software from the Internet and use it without
paying anything. If you wish, you may study the source code and change it to suit your
needs. The MySQL software uses the GPL (GNU General Public License),
 The MySQL Database Server is very fast, reliable, and easy to use.
If that is what you are looking for, you should give it a try. MySQL Server also has a
practical set of features developed in close cooperation with our users. You can find a
performance comparison of MySQL Server with other database managers on our
benchmark page. MySQL Server was originally developed to handle large databases
much faster than existing solutions and has been successfully used in highly
demanding production environments for several years. Although under constant
development, MySQL Server today offers a rich and useful set of functions. Its
connectivity, speed, and security make MySQL Server highly suited for accessing
databases on the Internet.
 MySQL Server works in client/server or embedded systems.
The MySQL Database Software is a client/server system that consists of a multi-
threaded SQL server that supports different backends, several different client
programs and libraries, administrative tools, and a wide range of application
programming interfaces (APIs).

The Main Features of MySQL

 Written in C and C++.


 Works on many different platforms.
 Uses multi-layered server design with independent
modules.
 Provides transactional and non-transactional storage
engines.
 Designed to make it relatively easy to add other storage
engines. This is useful if you want to provide an SQL
interface for an in-house database.
 Uses a very fast thread-based memory allocation system.
 Executes very fast joins using an optimized nested-loop join.
 Implements SQL functions using a highly optimized class
library that should be as fast as possible. Usually there is no
memory allocation at all after query initialization.
 Password security by encryption of all password traffic when
you connect to a server.
 Support for large databases. We use MySQL Server with
databases that contain 50 million records. We also know of
users who use MySQL Server with 200,000 tables and about
5,000,000,000 rows.
 MySQL client programs can be written in many languages. A
client library written in C is available for clients written in C
or C++, or for any language that provides C bindings.
 APIs for C, C++, Eiffel, Java, Perl, PHP, Python, Ruby, and Tcl
are available, enabling MySQL clients to be written in many
languages.

 The Connector/ODBC (MyODBC) interface provides MySQL


support for client programs that use ODBC (Open Database
Connectivity) connections.
 The Connector/J interface provides MySQL support for Java
client programs that use JDBC connections. Clients can be
run on Windows or UNIX. Connector/J source is available.

What is Python?
Python is a popular programming language. It was created by Guido van
Rossum, and released in 1991.

It is used for:

 web development (server-side),


 software development,
 mathematics,
 System scripting.

What can Python do?


 Python can be used on a server to create web applications.
 Python can be used alongside software to create workflows.
 Python can connect to database systems. It can also read and modify files.
 Python can be used to handle big data and perform complex mathematics.
 Python can be used for rapid prototyping, or for production-ready software
development.

Why Python?
 Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
 Python has a simple syntax similar to the English language.
 Python has syntax that allows developers to write programs with fewer lines
than some other programming languages.
 Python runs on an interpreter system, meaning that code can be executed as
soon as it is written. This means that prototyping can be very quick.
 Python can be treated in a procedural way, an object-orientated way or a
functional way.

Good to know?
 The most recent major version of Python is Python 3, which we shall be using in
this tutorial. However, Python 2, although not being updated with anything
other than security updates, is still quite popular.
 In this tutorial Python will be written in a text editor. It is possible to write
Python in an Integrated Development Environment, such as Thorny, Pycharm,
Netbeans or Eclipse which are particularly useful when managing larger
collections of Python files.

Python Syntax compared to other


programming languages
 Python was designed for readability, and has some similarities to the English
language with influence from mathematics.
 Python uses new lines to complete a command, as opposed to other
programming languages which often use semicolons or parentheses.
 Python relies on indentation, using whitespace, to define scope; such as the
scope of loops, functions and classes. Other programming languages often use
curly-brackets for this purpose.
SYSTEM IMPLEMENTATION

Hardware used:

While developing the system, the used hardware are:


PC with Pentium IV processor or sometimes,
PC with Celeron (1.7 GHz) processor having 256 MB RAM,
SVGA and other required devices.

Softwares used:

 Microsoft Windows® XP as Operating System.

 Python as Front-end Development environment.

 MySQL as Back-end Sever with Database for Testing.

 MS-Word 2007 for documentation.


PYTHON MODULE :MENULIB
import Book import
Member import issue

defMenuBook():
while True:
Book.clrscreen()
print("\t\t\t Book Record Management\n")
print("========================================================
======")
print("1. Add Book ")
Record
print("2. Display Book ")
Records
print("3. Search Book ")
Record
print("4. Delete Book ")
Record
print("5. Update Book ")
Record
print("6. Return to Main ")
Menu
print("===========================================================
====")
choice=int(input("Enter Choice between 1 to 5-------> :
")) if choice==1:
Book.insertData()
elifchoice==2:
Book.display()
elifchoice==3:
Book.SearchBookRec() elif
choice==4:
Book.deleteBook()
elifchoice==5:
print("No such Function") elif
choice==6:
return else:
print("WrongChoice. Enter Your Choiceagain")
x=input("Enter any key to continue")
#----------------------------------------------------------------------------------------
defMenuMember(): while
True:
Book.clrscreen()
print("\t\t\t Member Record Management\n")
print("================================================
==============")
print("1. Add Member ")
Record
print("2. Display Member ")
Records
print("3. Search Member ")
Record
print("4. Delete Member ")
Record
print("5. Update Book ")
Record
print("6. Return to Main ")
Menu
print("==================================================
=============")
choice=int(input("Enter Choice between 1 to
5-------> : ")) if choice==1:
Member.insertDa
ta() elifchoice==2:
Member.displ
ay()
elifchoice==3:
Member.SearchMe
mber() elif
choice==4:
Member.deleteMem
ber() elif choice==5:
print("No such
Function") elif
choice==6:
retu
rn
else:
print("WrongChoice. Enter Your Choiceagain")
x=input("Enter any key to continue")
#----------------------------------------------------------------------------------------
defMenuIssueReturn():
while True:
Book.clrscreen()
print("\t\t\t Member Record Management\n")
print("================================================
==============")
print("1.IssueBook ")
print("2. Display
IssuedBookRecords ")
print("3. ReturnIssuedBook
")
print("4. Return to Main Menu")
print("==================================================
=============")
choice=int(input("Enter Choice between 1 to
5-------> : ")) if choice==1:
issue.issueBookD
ata() elif
choice==2:
issue.ShowIssuedBo
oks() elif choice==3:
issue.returnB
ook()
elifchoice==4:
retu
rn
else:
print("WrongChoice. Enter Your Choiceagain")
x=input("Enter any key to continue")

MODULE : LIBRARY MANAGEMENT


importMen
uLib import
Book
import issue

while True:
Book.clrscreen()
print("\t\t\t Library Management\n")
print("================================================
==============")
print("1.BookManagement ")
print("2.
MembersManagements "
) print("3.Issue/ReturnBook
")
print("5.Exit ")
print("====================================================
===========")
choice=int(input("Enter Choice between 1 to
4-------> : ")) if choice==1:
MenuLib.MenuBoo
k() elifchoice==2:
MenuLib.MenuMe
mber() elif
choice==3:
MenuLib.MenuIssueReturn()
elif choice==4:
bre
ak
else:
print("WrongChoice. Enter Your Choiceagain")
x=input("Enter any key to continue")

# PYTHON MODULE : BOOK

importmysql.conn
ector
frommysql.connector import errorcode
fromdatetime import date, datetime,
timedelta from mysql.connector
import (connection) import os
import platform

defclrscreen():
ifplatform.system()=="Windows":
print(os.system("cls"))

def
display(
): try:
os.system('cls')
cnx = connection.MySQLConnection(user='root',
password='mysql', host='localhost',
database='LIbr
ary') Cursor =
cnx.cursor()
query = ("SELECT * FROM
BookRecord")
Cursor.execute(query)

for (Bno,Bname,Author,price,publ,qty,d_o_purchase) in Cursor:


print("=======================================================
=======")
print("BookCode :",Bno)
print("BookName : ",Bname)
print("AuthorofBook : ",Author)
print("PriceofBook : ",price)
print("Publisher : ",publ)
print("Total Quantityin Hand
:",qty)
print("PurchasedOn : ",d_o_purchase)
print("=================================================
==============")

Cursor.clo
se()
cnx.close(
)
print("You have done
it!!!!!!") except
mysql.connector.Error as
err:
iferr.errno ==
errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name
or password") eliferr.errno ==
errorcode.ER_BAD_DB_ERROR: print("Database
does not exist")
else:
print(e
rr) else:
cnx.close()
definsertDat
a(): try:
cnx = connection.MySQLConnection(user='root',
password='m
ysql',
host='127.0.0
.1',
database='Libr
ary') Cursor = cnx.cursor()

bno=input("EnterBookCode : ")
bname=input("EnterBookName :
") Auth=input("Enter
BookAuthor'sName : ")
price=int(input("Enter Book Price :
")) publ=input("Enter
PublisherofBook :")
qty=int(input("EnterQuantity purchased : "))
print("Enter Date of Purchase (Date/MOnth and
Year seperately: ") DD=int(input("EnterDate :"))
MM=int(input("Enter Month : "))
YY=int(input("Enter Year : "))
Qry = ("INSERT INTO BookRecord "\
"VALUES (%s, %s, %s, %s, %s, %s, %s)")
data =
(bno,bname,Auth,price,publ,qty,date(YY,M
M,DD)) Cursor.execute(Qry,data)
# Make sure data is committed to
the database cnx.commit()
Cursor.clo
se()
cnx.close(
)
print("RecordInserted....")
exceptmysql.connector.Error as err:
iferr.errno ==
errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name
or password")
eliferr.errno ==
errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print(e

rr)
cnx.clos

e()

defdeleteBo
ok(): try:
cnx = connection.MySQLConnection(user='root',
password='m
ysql',
host='127.0.0
.1',
database='Libr
ary') Cursor = cnx.cursor()

bno=input("Enter Book Code of Book to be deleted fromtheLibrary : ")


Qry=("""DELETE FROM BookRecord WHERE BNO = %s""")
del_rec=(bno,)
Cursor.execute(Qry,d
el_rec)

# Make sure data is committed to


the database cnx.commit()
Cursor.clo
se()
cnx.close(
)
print(Cursor.rowcount,"Record(s)DeletedSuccessfully ")
exceptmysql.connector.Error as err:
iferr.errno ==
errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name
or password")
eliferr.errno ==
errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print(e

rr)

cnx.clos

e()
defSearchBookR
ec(): try:
cnx = connection.MySQLConnection(user='root',
password='m
ysql',
host='127.0.0
.1',
database='Libr
ary') Cursor = cnx.cursor()

bno=input("Enter Book No to be Searched


fromtheLibrary :
") query = ("SELECT * FROM BookRecord where
BNo = %s")

rec_srch=(bno,)
Cursor.execute(query,re
c_srch)
Rec_count=0

for (Bno,Bname,Author,price,publ,qty,d_o_purchase) in Cursor:


Rec_count+=1
print("=======================================================
=======")
print("BookCode :",Bno)
print("BookName : ",Bname)
print("AuthorofBook : ",Author)
print("PriceofBook : ",price)
print("Publisher : ",publ)
print("Total Quantityin Hand
:",qty)
print("PurchasedOn : ",d_o_purchase)
print("=================================================
==============")
if Rec_count%2==0:
input("Press any key to
continue") clrscreen()
print(Rec_count, "Record(s) found")
# Make sure data is committed to
the database cnx.commit()
Cursor.clo
se()
cnx.close(
)

exceptmysql.connector.Error as err:
iferr.errno ==
errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name
or password")
eliferr.errno ==
errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print(err)

cnx.close(
)
defUpdateBo
ok():
try:
cnx = connection.MySQLConnection(user='root',
password='m
ysql',
host='127.0.0
.1',
database='Libr
ary') Cursor = cnx.cursor()

bno=input("Enter Book Code of Book to be Updated


fromtheLibrary :
") query = ("SELECT * FROM BookRecord where BNo =
%s")
rec_srch=(bno,)

print("Enter new data ")


bname=input("EnterBook
Name :"
)
Auth=input("Enter
BookAuthor'sName : ")
price=int(input("Enter Book Price : "))
publ=input("Enter PublisherofBook
: ")
qty=int(input("EnterQuantity
purchased :"))
print("Enter Date of Purchase (Date/MOnth and
Year seperately: ") DD=int(input("EnterDate :"))
MM=int(input("Enter Month : "))
YY=int(input("Enter Year : "))
Qry = ("UPDATE BookRecord SET bname=
%s,Author=%s,"\ "price=%s,publisher=
%s,qty=%s,d_o_purchase=%s "\
"WHERE BNO=%s")
data = (bname,Auth,price,publ,qty,date(YY,MM,DD),bno)

Cursor.execute(Qry,data)
# Make sure data is committed to the
database''' cnx.commit()
Cursor.clo
se()
cnx.close(
)
print(Cursor.rowcount,"Record(s)UpdatedSuccessfully ")
exceptmysql.connector.Erro
r as err:
iferr.errno ==
errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name
or password")
eliferr.errno ==
errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print(e
rr)
cnx.clos
e()
UpdateBook()

PYTHON MODULE : ISSUE

importmysql.connector
frommysql.connector import
errorcode from datetime
import date
frommysql.connector import
(connection) import os

defclrscree
n():
print('\n'
*5)
defShowIssuedBo
oks(): try:
os.system('cls')
cnx = connection.MySQLConnection(user='root',
password='mysql', host='localhost',
database='Libr
ary') Cursor =
cnx.cursor()
query = ("SELECT B.bno,bname,M.mno,mname,d_o_issue,d_o_ret FROM
bookRecordB,issue I"\ ",member M where B.bno=I.bno and
I.mno=M.mno")
Cursor.execute(query)

for (Bno,Bname,Mno,Mname,doi,dor) in Cursor:


print("=======================================================
=======")
print("BookCode :",Bno)
print("BookName : ",Bname)
print("MemberCode : ",Mno)
print("MemberName :
",Mname) print("Dateofissue
:",doi)
print("Dateofreturn : ",dor)

print("=================================================

==============")

Cursor.clo
se()
cnx.close(
)
print("You have done
it!!!!!!") except
mysql.connector.Error as
err:
iferr.errno ==
errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name
or password") eliferr.errno ==
errorcode.ER_BAD_DB_ERROR: print("Database
does not exist")
else:
print(e
rr) else:
cnx.close()
defissueBoo
k(): try:
cnx = connection.MySQLConnection(user='root',
password='m
ysql',
host='127.0.0
.1',
database='Libr
ary') Cursor = cnx.cursor()

bno=input("Enter Book Code to


issue : ")
mno=input("EnterMemberCode
:")
print("Enter Date of Issue (Date/MOnth and Year
seperately: ") DD=int(input("EnterDate :"))
MM=int(input("Enter Month : "))
YY=int(input("Enter Year : "))

Qry = ("INSERT INTO issue


(bno,mno,d_o_issue)"\ "VALUES
(%s, %s, %s)")
data =
(bno,mno,date(YY,MM,DD
))
Cursor.execute(Qry,data)
cnx.commit()
Cursor.clo
se()
cnx.close(
)
print("RecordInserted....")
exceptmysql.connector.Error as err:
iferr.errno ==
errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name
or password")
eliferr.errno ==
errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print(r

)
cnx.clos

()

defreturnBook():

try:

cnx = connection.MySQLConnection(user='root',
password='m
ysql',
host='127.0.0
.1',
database='Libr
ary') Cursor = cnx.cursor()

bno=input("Enter Book Code of Book to be returned to


the Library : ") Mno=input("Enter Member Code of
Member who isreturningBook
:"
)
retDate=date.today()
Qry=("""Update Issue set d_o_ret= %s WHERE BNO = %s
and Mno= %s """) rec=(retDate,bno,Mno)
Cursor.execute(Qry,rec)

# Make sure data is committed to


the database cnx.commit()
Cursor.clo
se()
cnx.close(
)
print(Cursor.rowcount,"Record(s)DeletedSuccessfully ")
exceptmysql.connector.Error as err:
iferr.errno ==
errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name
or password")
eliferr.errno ==
errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print(rr)

cnx.close()
PYTHON MODULE MEMBER
importmysql.connector
frommysql.connector import errorcode
fromdatetime import date, datetime,
timedelta from mysql.connector
import (connection) import os

defclrscree
n():
print('\n'
*5)

def
display(
): try:
os.system('cls')
cnx = connection.MySQLConnection(user='root', password='mysql',
host='localhos
t',
database='LIbr
ary')
Cursor = cnx.cursor()
query = ("SELECT * FROM
Member")
Cursor.execute(query)

for (Mno,Mname,MOB,DOP,ADR) in Cursor:


print("=======================================================
=======")
print("MemberCode :",Mno)
print("MemberName :
",Mname)
print("MobileNo.ofMember :
",MOB) print("DateofMembership
: ",DOP)
print("Address :",ADR)
print("=======================================================
========")

Cursor.clo
se()
cnx.close(
)
print("You have done
it!!!!!!") except
mysql.connector.Error as
err:
iferr.errno ==
errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name
or password") eliferr.errno ==
errorcode.ER_BAD_DB_ERROR: print("Database
does not exist")
else:
print(e
rr) else:
cnx.close()

definsertMemb
er(): try:
cnx = connection.MySQLConnection(user='root',
password='mysql',
host='127.0.0.1',
database='Libr
ary') Cursor = cnx.cursor()

mno=input("EnterMemberCode: ")
mname=input("EnterMemberNam
e : ")
mob=input("Enter
MemberMobileNo. :")
print("Enter Date of Membership (Date/MOnth and
Year seperately: ") DD=int(input("EnterDate :"))
MM=int(input("Enter Month : "))
YY=int(input("Enter Year : "))
addr=input("Enter Member Adress :
")
Qry = ("INSERT INTO
Member "\ "VALUES
(%s, %s, %s, %s, %s)")
data =
(mno,mname,mob,date(YY,MM,DD),a
ddr) Cursor.execute(Qry,data)
# Make sure data is committed to
the database cnx.commit()
Cursor.clo
se()
cnx.close(
)
print("RecordInserted....")
exceptmysql.connector.Error as err:
iferr.errno ==
errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name
or password")
eliferr.errno ==
errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print(e

rr)

cnx.clos

e()

defdeleteMemb
er(): try:
cnx = connection.MySQLConnection(user='root',
password='m
ysql',
host='127.0.0
.1',
database='Libr
ary') Cursor = cnx.cursor()

mno=input("Enter Member Code to be deleted fromtheLibrary :")

Qry=("""DELETE FROM Member WHERE MNO = %s""")


del_rec=(mno,)
Cursor.execute(Qry,d
el_rec)

# Make sure data is committed to


the database cnx.commit()
Cursor.clo
se()
cnx.close(
)
print(Cursor.rowcount,"Record(s)DeletedSuccessfully ")
exceptmysql.connector.Error as err:
iferr.errno ==
errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name
or password")
eliferr.errno ==
errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print(e

rr)

cnx.clos

e()

defSearchMem
ber(): try:
cnx = connection.MySQLConnection(user='root',
password='m
ysql',
host='127.0.0
.1',
database='Library')
Cursor = cnx.cursor()

mnm=input("Enter Book Name to be Searched fromtheLibrary :


") query = ("SELECT * FROM Member where MName = %s ")
rec_srch=(mnm,)
Cursor.execute(query,rec_srch)

Rec_count=0

for (Mno,Mname,MOB,DOP,ADR) in Cursor:


print("==========================================================
====")
print("MemberCode :",Mno)
print("MemberName : ",Mname)
print("MobileNo.ofMember : ",MOB)
print("DateofMembership : ",DOP)
print("Address :",ADR)
print("===============================================================")
if Rec_count%2==0:
input("Press any key to continue")
clrscreen()
print(Rec_count, "Record(s) found")
# Make sure data is committed to the database
cnx.commit()
Cursor.close()
cnx.close()

exceptmysql.connector.Error as err:
iferr.errno == errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name or
password")
eliferr.errno == errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print(err)
cnx.close()

REFERENCES
In order to work on this project titled –Library Management System, the following
books and literature are referred by me during the various phases of development of
the project.

(1) The Complete Reference Python

(2) Understanding SQL


– Gruber
(3) http://www.mysql.org/

(4) http://www.python.org/

(5) On-line Help of Python ®

(6) Informatics Practices for class XII


-by Sumita Arora
(7) Together with Informatics Practices
(6) Various Websites of Discussion Forum and software development activities.

Other than the above-mentioned books, the suggestions and supervision of my


teacher and my class experience also helped me to develop this software project.

You might also like