Sie sind auf Seite 1von 19

IP PROJECT ON -

LIBRARY
MANAGEMENT
SYSTEM

BY
NEHA GUNTA
SRI CHAITANYA TECHNO SCHOOL
ACKNOWLEDGEMENT
I express my sincere thanks to the institution of Sri Chaitanya
Techno School for providing necessary facilities which were
required for the completion of this project.
I would like to express my deep sense of thanks and gratitude to my
teacher and guide, for guiding and correcting me through the course
of building the project. She always expressed keen interest in my
work. Her constructive advice and constant motivation have been
my inspiration for the successful completion of this project.
I would also like to thank my parents and friends for their help,
support and constant motivation.

                                                                            
INDEX
                                                                                  
CONTENTS PAGE
NO.
INTRODUCTION TO THE PROJECT 3
FILES,LIBRARIES,TABLES AND 4
DATABASES
SOURCE CODE
 1)CONTENT EXPLANATION 8
2) PROGRAM CODE 9

SCREENSHOTS 21
BIBLIOGRAPHY 24

 
INTRODUCTION TO THE 
PROJECT:
    The project titled ‘ANsi’ is a library management system
software for borrowing and donation of books worldwide. The project is
made on ‘Python IDLE’ and ‘MySQL’.
This software focuses mainly on maintaining databases of users
,adding new users ,maintaining records of books,checking if the book is
available for renting or not and if book if not available provides other
options such as donation of books.
The usernames,passwords and book details are stored in MySQL
databases. The databases are accessed using Python IDLE. Python
IDLE acts as an interface between the user and the databases.
 
FILES, LIBRARIES, TABLES AND
DATABASES:

PYMYSQL: It is a pure Python-MySQL client library. In this


project it is used to connect MySQL and Python.
ANSI: ‘Ansi’ is the database which is used to create different tables
which are used in this project. The tables in this database are ‘login’
and ‘books’.
LOGIN: ‘login’ is the table which contains the login IDs and
passwords of different customers. 
‘login’ has three columns ‘Id’, ’loginId’ and ‘password’.
      ‘loginId’: stores the login IDs of customers.
      ‘password’: stores passwords of customers.

BOOKS: ‘books’ is the table which contains the list of books


which are available.
‘books’ has thirteen columns ‘bookId’, ’bookName’, ’bookAuthor’,
’journalCategory’, ‘journalSubCategory’, ‘s1’, ‘s2’, ‘s3’, ‘s4’, ‘s5’,
‘s6’, ‘s7’, ‘s8’.
    ‘bookId’: stores the codes for the books.
     ‘bookName’: stores the names of the books.
     ‘bookAuthor’: stores the author’s name.
     ‘journalCategory’: contains all the categories of genres
available.
     ‘journalSubCategory’: contains all the sub categories for the
genres.
      ‘s1’, ‘s2’, ‘s3’, ‘s4’, ‘s5’, ‘s6’, ‘s7’, ‘s8’: store the information
about slots. 
SOURCE CODE:
CONTENT EXPLANATION:
First the user must enter his/her username .
If the user is a registered user the he/she must enter his/her
password. If not then the user must create an account in ‘ANsi
library’.
Next a message is displayed which says ‘successfully
logged in’ and the user is asked to choose a genre - ‘Fiction’ or
‘Nonfiction’. The user must type the number corresponding to the
chosen genre.
Under each genre there are sub categories like horror,
comedy ,sci-fi etc.
After choosing a subcategory and a book in the respective
subcategory a message is displayed which says ‘which slot would
you prefer?’and the user is provided with  many time slot options in
which the user is required to select one time slot for borrowing
books and returning the book at the end of the time slot.If the slot is
available for booking then booking takes place or else an error
message is displayed which says ‘ Sorry this slot has been taken by
someone else’.
After booking a message is displayed which says
‘successfully booked.’.
The user is also given an option if he or she wants to donate
books.The usernames,passwords,book details and slot details are
stored in different tables in ‘ANsi’ database in ‘MySQL’. Book
booking is done using Python code which accesses all tables in
‘ANsi’ database.
PROGRAM CODE:
Python code:
import pymysql
conn=pymysql.connect(host='localhost',user='root',password='root',
database='ANsi')
a=conn.cursor()
z="\""
print('*************** Welcome to ANsi library******************')
uid=input('Enter your username: ')
pw=input('Enter your password: ')
a.execute("select count(id) from login where loginId like "+z+uid+z+" &&
password like"+z+pw+z+";")
count=a.fetchone()
if count==(1,):
print("********************Successfully logged in**************")
else:
d=input("Invalid username or password. press x to exit: ")
if d=='x':
exit()
print('which one would you prefer?')
g1=int(input('Please enter 1 for fiction and 2 for non fiction : '))
if g1==2:
print('1.Biography\n 2.History')
if g1==1:
print('1.Horror\n2.Sci-Fi\n3.Thriller\n4.Romance\n5.Murder and
Detective')
g2=input("Enter the genre of your choice : ")
a.execute("select bookId , bookName from books where journalSubCategory
like \""+g2+"\";")
book=a.fetchall()
print('Book-id\t\tBook Name')
for i in book:
for j in i:
print (j,end='\t\t')
print()

while (1):
id=input('\nEnter book id:')
a.execute("select count(*) from books where bookId ="+id)
c=a.fetchone()
if c==(1,):
break
else:
print("Book is not available!!\n")
d=input("press 1 to try again and x to exit: ")
if d=='x':
exit()
print("The slots available are")
print("\nslot-1(s1)\nslot-2(s2)\nslot-3(s3)\nslot-4(s4)\nslot-5(s5)\nslot-
6(s6)\nslot-7(s7)\nslot-8(s8)\n")
while(1):
sl=input('Choose your comfortable slot: ')
a.execute("select count(*) from books where bookId="+id+" and "+sl+" is
null;")
count=a.fetchone()
if count==(1,):
con=input('Your book is available in your selected slot. \n\nDo you
want to confirm your booking?\nEnter \'yes\' to proceed with your
booking\nEnter \'no\' to cancel your booking: ')
if con=='yes':
print('\nYour booking has been confirmed.\nYou can collect your
book at your nearest store. For further details contact your nearest
store.')
a.execute('update books set '+sl+'=1 where bookId='+id+';')
print('\nYour order number is 26353825')
break
elif count==(0,):
s=input("Sorry!! slot is already booked.\n Do you want to check
the availability of another slot?(y/n))")
if s== "y" :
continue
else:
break

print('************Thank You for visiting our online website *********')

 
 

MYSQL CODE:
show databases;
create database ANsi;
use ANsi;
 
CREATE TABLE login (
  `Id` int DEFAULT NULL,
  `loginId` varchar(20) DEFAULT NULL,
  `password` varchar(30) DEFAULT NULL
);
 
INSERT INTO login VALUES (1,'Shruthi','welcome1');
INSERT INTO login VALUES (2,'Agnes','welcome1');
INSERT INTO login VALUES (3,'Ishika','welcome1');
INSERT INTO login VALUES (4,'Neha','welcome1');
INSERT INTO login VALUES (5,'srichaitanya','welcome1');
INSERT INTO login VALUES (6,'aparna','welcome1');
INSERT INTO login VALUES (7,'deepthi','welcome1');
INSERT INTO login VALUES (8,'keerthi','welcome1');
INSERT INTO login VALUES (9,'tejasri','welcome1');
 
 
CREATE TABLE books (bookId int, bookName varchar(50),
bookAuthor varchar(30), journalCategory varchar(30),
journalSubCategory varchar(30),s1 int, s2 int, s3 int, s4 int,
s5 int, s6 int, s7 int, s8 int);
 
#Thriller
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory )
values (1,'The girl in the train','Paula Hawkins', 'Fiction','Thriller');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory )
values (2,'Gone Girls','Gilliam Flynn', 'Fiction','Thriller');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory )
values (3,'Dan Vinci Code','Dan Brown', 'Fiction','Thriller');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory )
values (4,'The Women in the Window','A.J. Finn',
'Fiction','Thriller');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory )
values (5,'A minute to midnight','David Baldacci',
'Fiction','Thriller');
 
#Horror
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (6,'Bad Seed','William March', 'Fiction','Horror');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (7,'At the Mountain of Madness','H.P LoverCraft',
'Fiction','Horror');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (8,'The Bloody Chamber','Angela Charter',
'Fiction','Horror');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (9,'Carrie','Stephen King', 'Fiction','Horror');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (10,'Come Closer','Sara Gran', 'Fiction','Horror');
 
 
# MurderAndDetective
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (11,'Murder on the Orient Express','Agatha Christie',
'Fiction','MurderAndDetective');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (12,'Death on Nile','Agatha Christie',
'Fiction','MurderAndDetective');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (13,'Sad cypress','Agatha Christie',
'Fiction','MurderAndDetective');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (14,'Taken at the flood','Agatha Christie',
'Fiction','MurderAndDetective');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (15,'Still house lake','Rachel caine',
'Fiction','MurderAndDetective');
 
# sci-Fi
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (16,'Enders Game','Orson Scottcard', 'Fiction','Sci-Fi');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (17,'The Martian Ray chronicles','Ray Bradbury',
'Fiction','Sci-Fi');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (18,'Stranger in a strange land','A.Heinlen', 'Fiction','Sci-Fi');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (19,'Solaris','Stainslaw Lem', 'Fiction','Sci-Fi');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (20,'InRobot','Isaac Asimov', 'Fiction','Sci-Fi');
 
 
# Biography
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (21,'Steve Jobs','Walter Isacson', 'Non-Fiction','Biography');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (22,'The diary of the young girl','Anne Frank', 'Non-
Fiction','Biography');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (23,'I am Malala','Malala yousafzai','Non-
Fiction','Biography');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (24,'Becoming','Michelle obama', 'Non-Fiction','Biography');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (25,'Educated','Tara Westover', 'Non-Fiction','Biography');
 
# History
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (26,'Oscar:A life','Mathew Sturgis', 'Non-Fiction','History');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (27,'Express:Queen Victoria and India','Miles Tailor', 'Non-
Fiction','History');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (28,'Birds in the ancient world','Jeremy Mynott','Non-
Fiction','History');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (29,'Building Anglosascor England','John Blair', 'Non-
Fiction','History');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (30,'The guns of August','Barbara w.Tuchman', 'Non-
Fiction','History');
 
 
# Romance
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (31,'Pride and Prejustice','Jane Austen', 'Fiction','Romance');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (32,'Fault in our stars','John green', 'Fiction','Romance');
 
insert into books (bookId , bookName, bookAuthor ,
journalCategory , journalSubCategory)
values (33,'Will grayson','John green','Fiction','Romance');
    SCREENSHOTS  
Entering wrong password

When the chosen slot is not available


Bibliography:
1. Informatics Practices (A textbook for class 12) by Sumita
Arora
2. Informatics Practices (A textbook for class 11) by Sumita
Arora
3. www.google.com
4. Wikipedia
5. https://www.python.org/downloads
6. https://www.mysql.com/downloads
7. https://www.w3schools.com/

 
 

 
 

Das könnte Ihnen auch gefallen