0% found this document useful (0 votes)
35 views23 pages

Project No 1 - 2

Uploaded by

chaitanyafam
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)
35 views23 pages

Project No 1 - 2

Uploaded by

chaitanyafam
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/ 23

BOOK STORE MANAGEMENT

SYSTEM
TABLE OF CONTENTS

1. Project Description
2. Glimpses of Python
3. Glimpses of MySQL
4. Hardware and Software Configuration
5. Tables in the Database
6. Source code
7. Output
8. Bibliography
PROJECT DESCRIPTION
The project Book Store Management System uses Python as front end and MySql as
backend. It aims to maintain the details of details of the books and staffs on the book store
in a systematic way. Book details are stored in MySql table for easy retrieval and access.
The following functionalities are included in the project:

• Add Book Details


• Remove Book Details
• Search Book Details
• Add Staff Details
• Remove Staff Details
• Display Staff Details
• Display Book Details
GLIMPSES OF PYTHON
Python is a high-level, general-purpose, self- contained programming language designed to
meet the needs of computer scientists, software developers and college students
interested in coding.

• Python was created in the early 1980s by Guido van Rossum.

• Python is a high-level, interpreted, dynamic object-oriented programming language that


can be used to program applications or web sites.

• It is also known as an object-oriented programming (OOP) language. The main benefits of


using Python instead of other languages are that it is very easy to start programming with
and because of its flexible syntax, it can be used to program almost any kind of software
application.

• Python is an open-source language that’s free to use and has a wide range of features
that make it easy to customize.
Python Features and Advantages
• Easy to Code - Python is a very high-level programming language, yet it is effortless to
learn.

• Easy to Read - Python code looks like simple English words.

• Free and Open-Source.

• Robust Standard Library.

• Interpreted.

• Portable.

• Object-Oriented and Procedure-Oriented.

• Extensible.
GLIMPSES OF MySQL
MySQL is a system that helps to store and manage data efficiently. Database generally
stores data in a structured fashion.

SALIENT FEATURES OF MYSQL

Quick and Reliable

MySQL stores data efficiently in the memory ensuring that data is consistent, and not
redundant. Hence, data access and manipulation using MySQL is quick.

Free to download

MySQL is free to use so that we can download it from MySQL official website without any
cost.

Scalable

Scalability refers to the ability of systems to work easily with small amounts of data, large
amounts of data, clusters of machines, and so on. MySQL server was developed to work
with large databases.

Data Types

It contains multiple data types such as unsigned integers, signed integers, float (FLOAT),
double (DOUBLE), character (CHAR), variable character (VARCHAR), text, blob, date, time,
datetime, timestamp, year, and so on.

Secure

It provides a secure interface since it has a password system which is flexible, and ensures
that it is verified based on the host before accessing the database. The password is
encrypted while connecting to the server.

Support for large databases

MySQL has no limit on the number of databases. The underlying filesystem may have a limit
on the number of directories. MySQL has no limit on the number of tables. The underlying
file system may have a limit on the number of files that represent tables. Individual storage
engines may impose engine-specific constraints. InnoDB permits up to 4 billion tables.
Client and Utility Programs

MySQL server also comes with many client and utility programs. This includes Command
line programs such as ‘mysqladmin’ and graphical programs such as ‘MySQL Workbench’.
MySQL client programs are written in a variety of languages. Client library (code
encapsulated in a module) can be written in C or C++ and would be available for clients that
have C bindings.

Compatible on many operating systems

MySQL is compatible to run on many operating systems, like Novell NetWare, Windows*
Linux*, many varieties of UNIX* (such as Sun*Solaris*, AIX, and DEC* UNIX), OS/2,
FreeBSD*, and others. MySQL also provides a facility that the clients can run on the same
computer as the server or on another computer (communication via a local network or the
Internet).

GUI Support

MySQL provides a unified visual database graphical user interface tool named "MySQL
Workbench" to work with database architects, developers, and Database Administrators.
HARD AND SOFTWARE CONFIGURATION
HARDWARE
• Operating System: Windows 10 or above

• Processor: Pentium 2.6GHz

• RAM: 4GB

• Hard Disk: SSD 128GB

SOFTWARE
• Windows OS

• Python 3.8 or above

• MySQL 8.0 Command Line Client


TABLES IN DATABASE
SOURCE CODE
import mysql.connector as ms

mycon = ms.connect(host='localhost',user="root",password="Password@123",database="
store")

mycursor = mycon.cursor ()

mycon.commit()

def addbooks():

global mycon,mycursor

print("All information prompted are mandatory to be filled")

book=str(input("Enter Book Name:"))

genre=str(input("Genre:"))

quantity=int(input("Enter quantity:"))

author=str(input("Enter author name:"))

publication=str(input("Enter publication house:"))

price=int(input("Enter the price:"))

mycursor.execute("select * from Available_Books where bookname='"+book+"'")

row=mycursor.fetchone()

if row is not None:

mycursor.execute("update Available_Books set quantity=quantity+'"+str(quantity)+"'


where bookname='"+book+"'")

mycon.commit()

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)
+"')")

mycon.commit()

print("""++++++++++++++++++++++

++SUCCESSFULLY ADDED++

++++++++++++++++++++++""")

def searchbook():

global mycon,mycursor

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()

if poll is not None:

print("""++++++++++++++++++++

++BOOK IS IN STOCK++

++++++++++++++++++++""")

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()
if home is not None:

print("""++++++++++++++++++++

++BOOK IS IN STOCK++

++++++++++++++++++++""")

mycursor.execute("select * from available_books where author='"+au+"'")

for z in mycursor:

print(z)

else:

print("BOOKS OF THIS AUTHOR ARE NOT AVAILABLE!!!!!!!")

mycon.commit()

def addstaff():

global mycon,mycursor

fname=str(input("Enter Fullname:"))

gender=str(input("Gender(M/F/O):"))

age=int(input("Age:"))

phno=int(input("Staff phone no.:"))

add=str(input("Address:"))

mycursor.execute("insert into Staff_details(name,gender,age,phonenumber,address)


values('"+fname+"','"+gender+"','"+str(age)+"','"+str(phno)+"','"+add+"')")

print("""+++++++++++++++++++++++++++++

+STAFF IS SUCCESSFULLY ADDED+

+++++++++++++++++++++++++++++""")

mycon.commit()

def removestaff():
global mycon,mycursor

nm=str(input("Enter staff name to remove:"))

mycursor.execute("select name from staff_details where name='"+nm+"'")

toy=mycursor.fetchone()

if toy is not None:

mycursor.execute("delete from staff_details where name='"+nm+"'")

print("""+++++++++++++++++++++++++++++++++

++STAFF IS SUCCESSFULLY REMOVED++

+++++++++++++++++++++++++++++++++""")

mycon.commit()

else:

print("STAFF DOESNOT EXIST!!!!!!")

def displaystaff():

global mycon,mycursor

mycursor.execute("select * from Staff_details")

run=mycursor.fetchone()

for t in mycursor:

print(t)

if run is not None:

print("EXISTING STAFF DETAILS...")

for t in mycursor:

print(t)

else:

print("NO STAFF EXISTS!!!!!!!")

mycon.commit()
def available_books():

global mycon,mycursor

mycursor.execute("select * from available_books order by bookname")

for v in mycursor:

print(v)

while True:

print("*******************BOOK STORE MANAGEMENT SYSTEM


**************************")

print("1. ADD NEW BOOK ")

print("2. SEARCH BOOK")

print("3. NEW STAFF ENTRY ")

print("4. REMOVE STAFF FROM THE STORE ")

print("5. DISPLAY STAFF DETAILS ")

print("6. DISPLAY AVAILABLE BOOKS")

print("7.EXIT")

print("*********************************************
**************************")

ans = int(input("Enter your choice :"))

if ans==1:

addbooks()

elif ans==2:

searchbook()

elif ans==3:

addstaff()

elif ans==4:
removestaff()

elif ans==5:

displaystaff()

elif ans==6:

available_books()

elif ans==7:

mycon.close()

break

else:

print("\nInvalidChoice!!")
OUTPUT
BIBLIOGRAPHY
Computer Science with Python – Sumitha Arora

Preethi Arora

You might also like