You are on page 1of 18

COMPUTER SCIENCE

INVESTIGATORY
PROJECT

NAME: SREEJITH
M
CLASS:
XII-C
ROLL NO:
SCHOOL:KENDRIYA VIDYALAYA NO:1,NAVAL
BASE,KOCHI
ACADEMIC YEAR:2022-2023

INDEX
SL.NO TITLE PAGE
NO

1. CERTIFICATE 03

2. ACKNOWLEDGEMENT 04

3. FACE PAGE 05

4. ABSTRACT 06

5. CODING 08

6. OUTPUT 15

7. BIBLIOGRAPHY 18

CERTIFICATE
Name of the institution: KENDRIYA VIDYALAYA NO 1,NAVAL BASE

Place : KOCHI

This is to certify that SREEJITH M

Roll No studying in class XII C

of this institute in the year 2022-2023 has completed a project work based on C.B.S.E
syllabus in COMPUTER and has given a satisfactory account of it in the report of the
investigatory project work during the year 2022-23.

Teacher-in-charge Principal

Internal Examiner External Examiner

Acknowledgement
I sincerely express my gratitude to the Almighty, whose blessings and
guidance has helped me complete my project successfully. I am
extremely thankful to my Computer teacher Mrs. Hema C.N , Kendriya
Vidyalaya No.1 Kochi for giving me timely suggestions and guidance
and supporting me all time so that I could complete my project in time
and also permitting me to use the facilities of the department and for
showing keen interest in the development of this project.

I also extend my profound gratitude to our principal Shri Anil Mohan,


for allowing me to use the laboratory and other facilities of the school.

I would also like to thank my parents as well as my group member


Akshay who helped me a lot in finishing the project within limited time.
I am making this project not only for marks but also to increase my
knowledge.

Once again I thank all those who helped me in doing this project.
Project on library
management

Group Members:
 Sreejith M
 Akshay V.S

Abstract

 Our application program is specially designed for


the public library.
 They lend books to the readers who have
subscribed with the Library.

 We have tried to maximise the efficiency and


stived for customer and user satisfaction.

 After thorough examination and analysis of the


needs of a Library, we have constructed the
program.

Coding

import mysql.connector as sq
def connector():
global mydb
global cursor
mydb = sq.connect(user='root', password='',
host='localhost',port=3306, database='lib')
cursor=mydb.cursor()
def menu():
while True:
print("---------------Welcome to Libray
management system------------------")

choice=int(input("""1)NEW Customer
DETAILS\n2)DELETION Customer DETAILS\
n3)UPDATION Customer DETAILS\n4)DISPLAY
Customer DETAILS\n5)Resturn or issue of books\
n6)Exit\nENTER YOU'R CHOICE:"""))
if choice==1:
new_customer()
elif choice==2:
deletion_customer()
elif choice==3:
updation_customer()
elif choice==4:
display_customer()
elif choice==5:
retisu()
elif choice==6:
print("BACK TO MENU")
menu()
else:
print("Wrong Choice>>> TRY AGIAN")
def new_customer():
connector()
if mydb.is_connected():
print("successfully connected")
sl=int(input("Enter admncode : "))
name=input("Enter name : ")
Phone=int(input("Enter phone number : "))

query="insert into books (Sl,name,ph_no) values


({},'{}',{})".format(sl,name,Phone)
cursor.execute (query)
print("Record added")
mydb.commit ()
mydb.close()
else:
print("not connected")
def deletion_customer():
connector()
if mydb.is_connected():

print('succesfully connected')
sl=int(input('Enter admission number to be
deleted'))

query="delete from books where


sl={}".format(sl)

cursor.execute(query)

mydb.commit()
mydb.close()
if cursor.rowcount>0:
print('record deleted')
else:
print('no such record')
def updation_customer():
connector()
if mydb.is_connected():
print("successfully connected")
sl=int(input("enter admission number"))
print("enter new data")
name=input("Enter name : ")
Phone=int(input("Enter phone number : "))

query="update books set name='{}',ph_no={}


where sl={}".format(name,Phone,sl)
cursor.execute(query)
mydb.commit()
else:
print("not connected")
mydb.close()
def display_customer():
connector()
if mydb.is_connected():
query="select * from books"
cursor.execute(query)
for(sl,name,Phone,book_id) in cursor:
print('+++++++++++++++++++++++++++++
+++++++')
print("sl:","\tname:","\t\tPhone:","\tbook_id")
print(sl,"\t",name,"\t",Phone,"\t",book_id)
print("total record",cursor.rowcount)

else:
print("not connected")
mydb.close()
def retisu():
connector()
if mydb.is_connected():
def display_issue():
query="select * from book_list where
status='available'"
cursor.execute(query)
for(book_id,sl,status,book_name) in cursor:
print('+++++++++++++++++++++++++++
+++++++++')
print("book_id:","\tbook_name:")
print(book_id," \t",book_name)
print("total record",cursor.rowcount)
def return_book(book_id,sl):
no=0
query="update book_list set status='{}',sl={}
where book_id ='{}'".format("available",no,book_id)
query2="update books set book_id={} where
sl={}".format(no,sl)
cursor.execute(query)
cursor.execute(query2)
mydb.commit()
def issue_book(book_id,sl):
query="update book_list set status='{}', sl={}
where book_id={}".format("ISSUE",sl,book_id)
query2="update books set book_id={} where
sl={}".format(book_id,sl)
cursor.execute(query)
cursor.execute(query2)
mydb.commit()
sl=int(input("Enter your sl no:"))
print("1)ISSUE")
print("2)Return")
choice=int(input("Enter the choice"))
if choice==1:
display_issue()
book_id=int(input("Enter the book id"))
issue_book(book_id,sl)
elif choice==2:
book_id=int(input("Enter the book id from the
book"))
return_book(book_id,sl)

menu()
Output
Bibliography
1) www.slideshare.com
2) www.wikipedia.org

You might also like