0% found this document useful (0 votes)
21 views22 pages

PDFen

Uploaded by

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

PDFen

Uploaded by

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

ANAND NIKETAN SCHOOL

SESSION:2024-2025

INVESTIGATORYPROJECT

Name- Pratham P. Bhatt

Roll No:

Class- 12th

Subject: Computer Science

Submitted to: Mr. UJAVAL JANI


CERTIFICATE
This is to certify that Mr. Pratham Bhatt of class 12th
Science ANAND NIKITEN SCHOOL, MEHSANA
completed the assigned project

ONCOMPUTERSCIENCE
Under the teacher's supervision. He has taken proper care
and shown utmost sincerity while collecting the data and
analyzing all the relevant information needed for the
project on the “Book store management system” and it
has been found satisfactory as per the guidelines issued by
C.B.S.E.

SIGNATURES:

Teacher Principal Examiner


MR. UJAVAL JANI

SCHOOLSEAL:
ACKNOWLEDGEMENT
First and foremost, I thank God for his assistance and
blessings. The work wouldn’t have been possible without
the guidance of my Computer Science Teacher who
provided a helping hand in the endeavor.
I am also indebted to my parents and classmates, whose
constant support and encouragement were also helpful for
attaining the project in this present form.

THANK YOU
Pratham Bhatt
DECLARATION
I do hereby declare that the work is presented in the
standard XII Science project entitled “Book Store
Management” is partial fulfillment of requirements
for the award of the All India Senior Certificate
Examination (AISCE) and submitted to the department
of Computer Science of Anand Niketan School,
Mehsana is an authentic record of my own work
carried out during academic 2024-2025 under the
supervision of Mr. Ujaval Jani Anand Niketan
School.

The matter presented in the project report has to been


submitted by me for the award of any other certificate
elsewhere.

With kind regards,


Pratham Bhatt
INDEX

SrNo. TOPIC PAGE NO.

1. OBJECTIVE OF 2
THE PROJECT
2. HARDWARE / SOFTWARE 3
REQUIREMENTS
4. MODULES 4

5. SOURCECODE 5-11

6. OUTPUT 12-15

7. MY SQL OUTPUT 16

8. BIBLIOGRAPHY 17
OBJECTIVE OF THE PROJECT:

The objective of this project is to design and implement a Bookstore


Management System that provides a user-friendly interface to manage books in
a bookstore. The system will include functionalities such as:

1. Add Book: Allowing users to add new books to the system by entering
relevant details such as title, author, price, genre, ISBN, and stock
quantity.
2. Delete Book: Enabling users to remove books from the inventory
based on specific criteria such as ISBN or title.
3. Update Book: Providing the capability to modify existing book details
such as price, stock quantity, author, or genre.
4. Search Book: Implementing a search function that allows users to find
books based on various parameters like title, author, genre, or ISBN.

The system will aim to improve the efficiency of managing a bookstore's


inventory, ensuring easy and quick access to book data, minimizing human error
in updating records, and supporting smooth operations of the bookstore.

Key Features:

• A simple interface to interact with the system.


• Data validation for book details.
• Secure book management with options for addition, deletion, and
updates.
• Quick and effective search capability to locate books easily.

This project will demonstrate the application of object-oriented programming


principles and data management techniques to a real-world problem.

2
HARDWAR REQUIREMENTS:
➢ Processor:IntelPentium4orlaterorcompatible
➢ HardDisk:410GBormore
➢ RAM:1GBormore
➢ Printer: Any
➢ Monitor: SVG A color monitor(touch screen or simple)

SOFTWAREREQUIREMENTS:

➢ Python 3.9.0 or higher


➢ MYSQL 8.0
➢ MS Word 2016

3
MODULES:

Modules used in this project:

1. mysql.connector: This method sets up a connection,


establishing a session with the MySQL server. If no
arguments are given, it uses the already configured or
default values. A connection with the MySQL server
can be established using either:
o mysql.connector.connect(): This method is used

to create a connection object and establish a


session with the MySQL server.
o mysql.connector.MySQLConnection(): This is

an alternative to the above method. It is also used


to create a connection with the MySQL server.

4
SOURCECODE
import mysql.connector

# Connect to MySQL database


mydb = mysql.connector.connect(host="localhost", user="root",
password="Pratham")
mycursor = mydb.cursor()

# Create database and tables


mycursor.execute("CREATE DATABASE IF NOT EXISTS store")
mycursor.execute("USE store")

# Create signup and Available_Books table


mycursor.execute("CREATE TABLE IF NOT EXISTS signup(username VARCHAR(20),
password VARCHAR(20))")
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)
)""")

# Create Sell_rec table (added missing table for sales records)


mycursor.execute("""CREATE TABLE IF NOT EXISTS Sell_rec(
CustomerName VARCHAR(20),
PhoneNumber CHAR(10) UNIQUE,
BookName VARCHAR(30),
Quantity INT(3),
Price INT(4),
Total_Amount INT(200),
FOREIGN KEY (BookName) REFERENCES Available_Books(BookName)
)""")

mydb.commit()

5
# Main menu loop
while True:
print("\n\n1: Signup 2: Login")
ch = int(input("SIGNUP/LOGIN (1, 2): "))

# SIGNUP
if ch == 1:
username = input("USERNAME: ")
pw = input("PASSWORD: ")

# Insert user data into signup table


mycursor.execute("INSERT INTO signup (username, password) VALUES (%s,
%s)", (username, pw))
mydb.commit()
print("++++++++++++++++++++++++ SUCCESSFULLY SIGNED UP
+++++++++++++++++++++++")

# LOGIN
elif ch == 2:
username = input("USERNAME: ")
mycursor.execute("SELECT username FROM signup WHERE username = %s",
(username,))
pot = mycursor.fetchone()

if pot is not None:


print("VALID USERNAME!!!!!!!")
pw = input("PASSWORD: ")
mycursor.execute("SELECT password FROM signup WHERE username = %s",
(username,))
a = mycursor.fetchone()

if a is not None and a[0] == pw:


print("++++++++++++++++++++++++ LOGIN SUCCESSFUL
+++++++++++++++++++++++")
print("===============+++++++++++++++++++++++++ MY BOOK
6
STORE ++++++++++++++++++++++++++===================")
while True:
print("""\n\n\n\n\n\n\n\n\n1: Add Books \n2: Search Books
\n3: Delete Book \n4: Update Book \n5: Available Books \n6: Total
Income after the Latest Reset \n7: Exit""")
a = int(input("\n\nEnter your choice: "))

# ADD BOOKS
if a == 1:
print("\nAll information prompted are mandatory to be filled\n")
book = input("Enter Book Name: ")
genre = input("Genre: ")
quantity = int(input("Enter quantity: "))
author = input("Enter author name: ")
publication = input("Enter publication house: ")
price = int(input("Enter the price: "))

mycursor.execute("SELECT * FROM Available_Books WHERE


BookName = %s", (book,))
row = mycursor.fetchone()

if row is not None:


mycursor.execute("UPDATE Available_Books SET Quantity =
Quantity + %s WHERE BookName = %s", (quantity, book))
mydb.commit()
print("++++++++++++++++++++++++ SUCCESSFULLY ADDED
+++++++++++++++++++++++")
else:
mycursor.execute("INSERT INTO Available_Books (BookName,
Genre, Quantity, Author, Publication, Price) VALUES (%s, %s, %s, %s, %s, %s)",
(book, genre, quantity, author, publication, price))
mydb.commit()
print("++++++++++++++++++++++++ SUCCESSFULLY ADDED
+++++++++++++++++++++++")

7
elif a == 2:
print("""1: Search by name \n2: Search by genre \n3: Search by
author""")
l = int(input("Search by?: "))

if l == 1:
o = input("Enter Book to search: ")
mycursor.execute("SELECT BookName FROM Available_Books
WHERE BookName = %s", (o,))
tree = mycursor.fetchone()
if tree:
print("++++++++++++++++++++++ BOOK IS IN STOCK
+++++++++++++++++++++++")
else:
print("BOOK IS NOT IN STOCK!!!!!!!")

elif l == 2:
g = input("Enter genre to search: ")
mycursor.execute("SELECT * FROM Available_Books WHERE Genre =
%s", (g,))
poll = mycursor.fetchall()
if poll:
print("++++++++++++++++++++++ BOOKS ARE IN STOCK
+++++++++++++++++++++++")
for y in poll:
print(y)
else:
print("BOOKS OF SUCH GENRE ARE NOT AVAILABLE!!!!!!!!!")
elif l == 3:
au = input("Enter author to search: ")
mycursor.execute("SELECT * FROM Available_Books WHERE Author = %s",
(au,))
home = mycursor.fetchall()
if home:
print("++++++++++++++++++++++ BOOKS ARE IN STOCK
+++++++++++++++++++++++")

8
for z in home:
print(z)
else:
print("BOOKS OF THIS AUTHOR ARE NOT AVAILABLE!!!!!!!")

# DELETE BOOK
elif a == 3:
book = input("Enter the name of the book to delete: ")
mycursor.execute("SELECT * FROM Available_Books WHERE
BookName = %s", (book,))
row = mycursor.fetchone()

if row is not None:


mycursor.execute("DELETE FROM Available_Books WHERE
BookName = %s", (book,))
mydb.commit()
print(f"++++++++++++++++++++++++ BOOK '{book}' DELETED
+++++++++++++++++++++++")
else:
print("BOOK NOT FOUND!")

# UPDATE BOOK
elif a == 4:
book = input("Enter the name of the book to update: ")
mycursor.execute("SELECT * FROM Available_Books WHERE
BookName = %s", (book,))
row = mycursor.fetchone()

if row is not None:


print("1: Update Quantity")
print("2: Update Price")
update_choice = int(input("Choose what to update: "))
if update_choice == 1:
new_quantity = int(input("Enter new quantity: "))
mycursor.execute("UPDATE Available_Books SET Quantity = %s
WHERE BookName = %s", (new_quantity, book))

9
mydb.commit()
print(f"++++++++++++++++++++++++ QUANTITY FOR '{book}' UPDATED
+++++++++++++++++++++++")
elif update_choice == 2:
new_price = int(input("Enter new price: "))
mycursor.execute("UPDATE Available_Books SET Price = %s WHERE
BookName = %s", (new_price, book))
mydb.commit()
print(f"++++++++++++++++++++++++ PRICE FOR '{book}' UPDATED
+++++++++++++++++++++++")
else:
print("BOOK NOT FOUND!")

# AVAILABLE BOOKS
elif a == 5:
mycursor.execute("SELECT * FROM Available_Books ORDER BY BookName")
for v in mycursor:
print(v)

10
# EXIT
elif a == 6:
print("\nThank you")
break

else:
print("++++++++++++++++++++++++ INCORRECT PASSWORD
+++++++++++++++++++++++")
else:
print("++++++++++++++++++++++ INVALID USERNAME
+++++++++++++++++++++++")

else:
break

11
OUTPUT

12
13
14
FD

15
MY SQL OUTPUT:

16
BIBLIOGRAPHY:

1. Book–Python by Sumita Arora


2. www.python.org
3. https://www.geeksforgeeks.org

17
18

You might also like