CS Project Work
CS Project Work
-2
SATNA (M.P.) 485113. CONTACT NO.
CBSE Affiliation No.: 1000092
The
Submitted in fulfillment
Of
Practical Examination
Session 2022-2023
In
The
Submitted in fulfillment
Of
Practical Examination
Session 2022-2023
In
ncere thanks to the principal Smt. M. Prasad, Kendriya Vidyalaya No.2 Satna for her
encouragement and for all the facilities that she provided for this project work. I
sincerely appreciate this magnanimity by taking me into her fold for which I shall
remain indebted to her.
arma Computer Science teacher, who guided me to the successful completion of this
project. I take this opportunity to express my deep sense of gratitude for his
invaluable guidance, constant encouragement, immense motivation, which has
sustained my efforts at all the stages of this “Book Store Management” Project
work.
my parents and also to my classmates who helped me to carry out this project work
successfully and for their valuable advice and support, which I received from
them time to time.
AADARSH SONI
BLE OF CONTENTS
INTRODUCTION 6
SOURCE CODE 7
OUTPUT 15
BIBLIOGRAPHY 18
INTRODUCTION
The Book Store Management Program is written in python programming
language, in this Project, will teach you how to create and use the Book
Store Management Program. This is a Project to make a program that
manages your Book store, and made using Python and MySQL Language
and MySQL-Connector modules. We will be storing our data in MySQL
database.
In this project user can sign up and also login using password saved in
database, then we can perform various activities like:
#import mysql.connector
while True:
print(
"""1:Signup
2:Login"""
)
ch = int(input("SIGNUP/LOGIN(1,2):"))
# SIGNUP
if ch == 1:
username = input("USERNAME:")
pw = input("PASSWORD:")
# LOGIN
elif ch == 2:
username = input("USERNAME:")
mycursor.execute(
"select username from signup where username='" + username + "'"
)
pot = mycursor.fetchone()
pw = input("PASSWORD:")
mycursor.execute("select password from signup where password='" + pw +
"'")
a = mycursor.fetchone()
if a is not None:
print(
"""+++++++++++++++++++++++
+++LOGIN SUCCESSFULL+++
+++++++++++++++++++++++"""
)
print(
"""======================================================================
++++++++++++++++++++++++++ MY BOOK STORE +++++++++++++++++++++++++
=========================================================================="""
)
mycursor.execute(
"create table if not exists Available_Books(BookName
varchar(30) primary key,Genre varchar(20),Quantity int(3),Author
varchar(20),Publication varchar(30),Price int(4))"
)
mycursor.execute(
"create table if not exists Sell_rec(CustomerName
varchar(20),PhoneNumber char(10) unique key, BookName varchar(30),Quantity
int(100),Price int(4),foreign key (BookName) references
Available_Books(BookName))"
)
mycursor.execute(
"create table if not exists Staff_details(Name varchar(30),
Gender varchar(10),Age int(3), PhoneNumber char(10) unique key , Address
varchar(40))"
)
mydb.commit()
while True:
print(
"""1:Add Books
2:Delete Books
3:Search Books
4:Staff Details
5:Sell Record
6:Available Books
7:Total Income after the Latest Reset
8:Exit"""
)
# ADD BOOKS
if a == 1:
mycursor.execute(
"select * from Available_Books where bookname='"
+ book
+ "'"
)
row = mycursor.fetchone()
print(
"""++++++++++++++++++++++
++SUCCESSFULLY ADDED++
++++++++++++++++++++++"""
)
else:
mycursor.execute(
"insert into
Available_Books(bookname,genre,quantity,author,publication,price) values('"
+ book
+ "','"
+ genre
+ "','"
+ str(quantity)
+ "','"
+ author
+ "','"
+ publication
+ "','"
+ str(price)
+ "')"
)
mydb.commit()
print(
"""++++++++++++++++++++++
++SUCCESSFULLY ADDED++
++++++++++++++++++++++"""
)
# DELETE BOOKS
elif a == 2:
print("AVAILABLE BOOKS...")
mycursor.execute(
"select quantity from available_books where
bookname='"
+ book
+ "'"
)
lk = mycursor.fetchone()
if max(lk) < n:
print(n, "Books are not available!!!!")
else:
mycursor.execute(
"select bookname from available_books where
bookname='"
+ book
+ "'"
)
log = mycursor.fetchone()
print(
"""++++++++++++++++++++++
++BOOK HAS BEEN SOLD++
++++++++++++++++++++++"""
)
else:
print("BOOK IS NOT AVAILABLE!!!!!!!")
print(
"""1:Search by name
2:Search by genre
3:Search by author"""
)
l = int(input("Search by?:"))
# BY BOOKNAME
if l == 1:
o = input("Enter Book to search:")
mycursor.execute(
"select bookname from available_books where
bookname='"
+ o
+ "'"
)
tree = mycursor.fetchone()
if tree != None:
print(
"""++++++++++++++++++++
++BOOK IS IN STOCK++
++++++++++++++++++++"""
)
else:
print("BOOK IS NOT IN STOCK!!!!!!!")
# BY GENRE
elif l == 2:
g = input("Enter genre to search:")
mycursor.execute(
"select genre from available_books where genre='"
+ g
+ "'"
)
poll = mycursor.fetchall()
mycursor.execute(
"select * from available_books where genre='"
+ g
+ "'"
)
for y in mycursor:
print(y)
else:
print("BOOKS OF SUCH GENRE ARE NOT
AVAILABLE!!!!!!!!!")
# BY AUTHOR NAME
elif l == 3:
au = input("Enter author to search:")
mycursor.execute(
"select author from available_books where
author='"
+ au
+ "'"
)
home = mycursor.fetchall()
mycursor.execute(
"select * from available_books where author='"
+ au
+ "'"
)
for z in mycursor:
print(z)
else:
print("BOOKS OF THIS AUTHOR ARE NOT
AVAILABLE!!!!!!!")
mydb.commit()
# STAFF DETAILS
elif a == 4:
print("1:New staff entry")
print("2:Remove staff")
print("3:Existing staff details")
mycursor.execute(
"insert into
Staff_details(name,gender,age,phonenumber,address) values('"
+ fname
+ "','"
+ gender
+ "','"
+ str(age)
+ "','"
+ str(phno)
+ "','"
+ add
+ "')"
)
print(
"""+++++++++++++++++++++++++++++
+STAFF IS SUCCESSFULLY ADDED+
+++++++++++++++++++++++++++++"""
)
mydb.commit()
# REMOVE STAFF
elif ch == 2:
nm = str(input("Enter staff name to remove:"))
mycursor.execute(
"select name from staff_details where name='" + nm
+ "'"
)
toy = mycursor.fetchone()
else:
print("STAFF DOESNOT EXIST!!!!!!")
else:
print("NO STAFF EXISTS!!!!!!!")
mydb.commit()
# SELL HISTORY
elif a == 5:
print("1:Sell history details")
print("2:Reset Sell history")
if ty == 1:
mycursor.execute("select * from sell_rec")
for u in mycursor:
print(u)
if ty == 2:
bb = input("Are you sure(Y/N):")
if bb == "Y":
mycursor.execute("delete from sell_rec")
mydb.commit()
elif bb == "N":
pass
# AVAILABLE BOOKS
elif a == 6:
mycursor.execute(
"select * from available_books order by bookname"
)
for v in mycursor:
print(v)
else:
print(
"""++++++++++++++++++++
++INVALID USERNAME++
++++++++++++++++++++"""
)
else:
break
OUTPUT
1:Signup
2:Login
SIGNUP/LOGIN(1,2):1
USERNAME:Aadarsh
PASSWORD:12345678
1:Signup
2:Login
SIGNUP/LOGIN(1,2):2
USERNAME:Aadarsh
VALID USERNAME!!!!!!
PASSWORD:12345678
+++++++++++++++++++++++
+++LOGIN SUCCESSFULL+++
+++++++++++++++++++++++
====================================================================
==
++++++++++++++++++++++++++ MY BOOK STORE ++++++++++++++++++++++++
+
====================================================================
======
1:Add Books
2:Delete Books
3:Search Books
4:Staff Details
5:Sell Record
6:Available Books
7:Total Income after the Latest Reset
8:Exit
Enter your choice:1
All information prompted are mandatory to be filled
Enter Book Name:Ncert Maths class 12
Genre:Narrative
Enter quantity:5
Enter author name:Cbse
Enter publication house:NCERT, New Delhi
Enter the price:550
++++++++++++++++++++++
++SUCCESSFULLY ADDED++
++++++++++++++++++++++
1:Add Books
2:Delete Books
3:Search Books
4:Staff Details
5:Sell Record
6:Available Books
7:Total Income after the Latest Reset
8:Exit
Enter your choice:3
1:Search by name
2:Search by genre
3:Search by author
Search by?:1
Enter Book to search:Ncert Maths class 12
++++++++++++++++++++
++BOOK IS IN STOCK++
++++++++++++++++++++
1:Add Books
2:Delete Books
3:Search Books
4:Staff Details
5:Sell Record
6:Available Books
7:Total Income after the Latest Reset
8:Exit
Enter your choice:8
LIMITATION AND
SUGGESTION
Website
https://www.geeksforgeeks.org
https://www.mysql.com
https://www.python.org
Source Code
https://drive.google.com/file/d/1FUul1zk2M9Qw_JA1RsXRVnGBGAHQGzj3/view?usp=sharing