Project Raghav
Project Raghav
Raghav
Bachheti
12th – B
This is to certify that Raghav Bachheti of Class XII has
successfully completed the Computer Science project
titled Computer Sales And Services System under
the guidance of Ms. Sucheta Mam for the academic
year 2024-25.
The project represents the student’s own work and
reflects their dedication and thorough research on the
subject. The student has met all the requirements and
deadlines, making this project eligible for evaluation by
the school.
Date:
Teacher’s Signature
Acknowledgement
What is MySQL-Python Connectivity?
Project Review
Project Code
Queries
Database
Bibliography
I would like to express my sincere gratitude to all
those who contributed to the successful completion of
this
project.
Firstly, I would like to thank my teacher Ms.
Sucheta Mam for her valuable guidance, support,
and
encouragement throughout the course of this project.
Her expertise helped shape this work and provided
me with a clear direction.
I also extend my gratitude to the Principal Mam
whose resources and infrastructure were crucial to the
development and completion of this project
A special mention goes to my project partner Piyush,
who offered both moral support and intellectual
input at various stages of the project.
Lastly, I would like to thank my family, for their
unwavering support, patience, and
encouragement.
This project would not have been possible without
the contributions and support of all these individuals.
Thank you!
Python-MySQL connectivity allows Python applications
to interact with MySQL databases, enabling
developers to perform database operations such as
querying,
inserting, updating, and deleting data. This is
achieved using a MySQL connector library, such as
mysql-
connector-python, which provides an interface
between Python and the MySQL.
To establish a connection, you need to install the
MySQL connector using: pip install mysql-connector-
python. After that, you can connect to the MySQL
server by providing necessary credentials.
Once connected, you can use cursor objects to
execute SQL queries and fetch results. Python-MySQL
connectivity is widely used in web development, data
analysis, and business applications, making it
essential for building database-driven applications.
This project is a computer science application that
manages customer, sales, service, and rating
records for a business named "Rocket Computers."
It uses
MySQL to store and retrieve data, allowing users to
add and view customer details, sales transactions,
service requests, service issues, and customer
feedback. The
project aims to streamline business operations
by efficiently managing key data points.
# Import Module
import mysql.connector as sql
from mysql.connector import Error
# Set-Up Connection
try:
con = sql.connect(host="localhost", user="root",
password="mysql123")
if con.is_connected():
print("Successfully
connected.") cur = con.cursor()
except Error as e:
print("Error:",e)
exit()
# Create Database
cur.execute('Create database if not exists
Rocket_Computers;')
cur.execute('use Rocket_Computers')
con.commit()
# Create Tables
def create_tables():
# Create Table Customers
cur.execute('''Create table if not exists Customers (
Phone varchar(15) primary key,
Name varchar(30),
EMail varchar(50) not null,
Address varchar(50) not null);''')
# Save Tables
con.commit()
# Add Ratings
def add_rating():
r_id = int(input('Enter rating ID:'))
c_p = input("Enter customer phone number:")
s_r = int(input("Enter service rating (1-5):"))
p_r = int(input("Enter product rating (1-5):"))
f = input("Enter feedback (optional):")
r_d = input("Enter rating date (YYYY-MM-DD):")
cur.execute('''Insert into Ratings
(Rating_ID, Customer_Phone, Service_Rating,
Product_Rating, Feedback, Rating_Date)
values (%s,%s,%s,%s,%s,%s);''', (r_id, c_p, s_r, p_r, f, r_d))
con.commit()
print("Rating added successfully!")
# Main Menu
def main_menu():
while True:
print("Welcome to Rocket Computer Sales and Services")
print("1. Add Customer")
print("2. Add Sale")
print("3. Add Sale Problem")
print("4. Add Service")
print("5. Add Service Problem")
print("6. Add Rating")
print("7. View Sales Records")
print("8. View Service
Records") print("9. Exit")
ch = input("Enter your choice: ")
if ch == '1':
add_customer()
elif ch == '2':
add_sale()
elif ch == '3':
add_sale_problem()
elif ch == '4':
add_service()
elif ch == '5':
add_service_problem()
elif ch == '6':
add_rating()
elif ch == '7':
view_sales()
elif ch == '8':
view_services()
elif ch == '9':
break
else:
print("Invalid choice. Please try again.")
Adding Services:
Adding Service Problem:
Adding Ratings
View Sales Records: