0% found this document useful (0 votes)
19 views16 pages

Contents

Uploaded by

yuvrajthakkar886
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)
19 views16 pages

Contents

Uploaded by

yuvrajthakkar886
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/ 16

Car Showroom in

Python and SQL


COMPUTER SCIENCE INVESTIGATORY PROJECT

Submitted By :-
• Ritik Sharma
• Kshitij More
• Yash Kumar Singh
• Yuvraj Thakkar
Contents

1. Introduction to the Project

2. Hardware and Software Requirements

3. Python Coding

4. Output of the Project

5. References

PAGE 1
Introduction to the Project
The bustling world of car showrooms thrives on organization and efficiency. Managing a
plethora of vehicles, customers, and sales processes demands meticulous handling of data.
This investigative project dives headfirst into the exhilarating realm of computer science,
aiming to develop a streamlined car showroom management system using the potent duo
of Python and databases.

Our ambition? To automate and revolutionize the operations of a car showroom, replacing
cumbersome manual practices with a digital interface. Forget dusty files and endless
spreadsheets – envision a sleek system that tracks inventory, facilitates sales, monitors
customer interactions, and generates insightful reports, all at the click of a button.

This venture delves into the heart of database design, architecting a robust structure that
meticulously stores car details, customer information, and transaction history. To unlock
the power of this structure, we harness the versatility of Python, employing its rich libraries
to develop an intuitive user interface and automate essential tasks.

Driven by the desire to optimize workflow and enhance customer experience, this project
embarks on a fascinating journey through the realms of programming and data
management. We pledge to explore the intricate interplay of logic and design, translating
real-world challenges into a powerful software solution.

Join us as we unveil the inner workings of car showroom management, weaving a tapestry
of captivating code and meticulous data organization. Witness the transformation of
tedious manual tasks into automated processes, paving the way for a future where
showrooms hum with the precision of digital intelligence.

Prepare to be captivated by the fusion of technology and business acumen. Dive into the
world of databases and programming, and together, let's revolutionize the car showroom
experience, one line of code at a time!

PAGE 2
Hardware and Software
Requirements

HARDWARE:
Processor- Pentium ® G2030 @ 3.70GH

Processor speed- 533MHz

Ram- 2GB or more

Hard disk- 2.00GB

SOFTWARE:
Operating system- Windows 7 or above

IDE- IDLE Python

Front end- Python 3.6 or above

Back end- MySQL server 5.0 or above

PAGE 3
Python Coding
FILE 1:
import mysql.connector

db = mysql.connector.connect( host="localhost", username="root", password="dpvn",


database="kryy")

cur=db.cursor()

# Drop the database if it exists

cur.execute("""drop database if exists KRYY """)

# Create the 'luxury_cars' database

cur.execute("""create database KRYY """)

# Connect to the 'luxury_cars' database

db.database = 'KRYY'

# Create the main table 'cars'

cur.execute("""

CREATE TABLE cars (

car_id INT PRIMARY KEY AUTO INCREMENT,

brand VARCHAR(255) NOT NULL,

model VARCHAR(255) NOT NULL

""")

# Create sub-table for Bugatti

cur.execute("""

PAGE 4
CREATE TABLE bugatti (

bugatti_id INT PRIMARY KEY ,

model VARCHAR(255) NOT NULL,

foreign key (bugatti_id) references cars(car_id)

""")

# Create sub-table for Koenigsegg

cur.execute("""

CREATE TABLE koenigsegg (

koenigsegg_id INT PRIMARY KEY ,

model VARCHAR(255) NOT NULL,

foreign key (koenigsegg_id) references cars(car_id)

""")

# Create sub-table for Lamborghini

cur.execute("""

CREATE TABLE lamborghini (

lamborghini_id INT PRIMARY KEY,

model VARCHAR(255) NOT NULL,

foreign key (lamborghini_id) references cars(car_id)

""")

PAGE 5
# Create sub-table for Rolls-Royce

cur.execute("""

CREATE TABLE rolls_royce (

rolls_royce_id INT PRIMARY KEY ,

model VARCHAR(255) NOT NULL,

foreign key (rolls_royce_id) references cars(car_id)

""")

# Create sub-table for Bentley

cur.execute("""

CREATE TABLE bentley (

bentley_id INT PRIMARY KEY ,

model VARCHAR(255) NOT NULL,

foreign key (bentley_id) references cars(car_id)

""")

# Create sub-table for Porsche

cur.execute("""

CREATE TABLE porsche (

porsche_id INT PRIMARY KEY ,

PAGE 6
model VARCHAR(255) NOT NULL,

foreign key (porsche_id) references cars(car_id)

""")

# Create sub-table for Toyota Supra

cur.execute("""

CREATE TABLE toyota_supra (

toyota_supra_id INT PRIMARY KEY ,

model VARCHAR(255) NOT NULL,

foreign key (toyota_supra_id) references cars(car_id)

""")

# Insert example data into the tables

cur.execute("""

INSERT INTO cars (car_id,brand, model)

VALUES ('Bugatti', 'Chiron'),

('Bugatti', 'Divo'),

('Koenigsegg', 'Regera'),

('Koenigsegg', 'Jesko'),

('Lamborghini', 'Aventador'),

('Lamborghini', 'Huracán'),

('Rolls-Royce', 'Phantom'),

PAGE 7
('Rolls-Royce', 'Cullinan'),

('Bentley', 'Continental GT'),

('Bentley', 'Bentayga'),

('Porsche', '911 Carrera'),

('Porsche', 'Taycan'),

('Toyota Supra', 'GR Supra'),

('Toyota Supra', 'GR Supra RZ')

""")

# Close the cursor and database connection

db.commit()

db.close()

FILE2:
import mysql.connector

db = mysql.connector.connect(

host="localhost",

username="root",

password="dpvn",

database="kryy"

cur=db.cursor()

PAGE 8
def add():

carid=input("Enter CarID")

brand = input("Enter brand: ")

model = input("Enter model: ")

# Replace 'cars' with the actual table name

query = "INSERT INTO cars VALUES ({},'{}', '{}')".format(carid,brand, model)

cur.execute(query)

db.commit()

print("Record added successfully.")

def search():

query = "SELECT * FROM cars"

cur.execute(query)

result = cur.fetchall()

print("Brand\tModel")

for row in result:

print(row[1], "\t", row[2])

def update():

brand = input("Enter brand: ")

model = input("Enter model: ")

new_brand = input("Enter new brand: ")

new_model = input("Enter new model: ")

PAGE 9
# Replace 'cars' with the actual table name

query = "UPDATE cars SET brand = '{}', model = '{}' WHERE brand = '{}' AND
model = '{}'".format(new_brand, new_model, brand, model)

cur.execute(query)

db.commit()

print("Record updated successfully.")

def delete():

brand = input("Enter brand: ")

model = input("Enter model: ")

# Replace 'cars' with the actual table name

query = "DELETE FROM cars WHERE brand = '{}' AND model = '{}'".format(brand,
model)

print("Record deleted")

def tasks():

print("$$$$$$$$$$ Wecome To KRYY Cars $$$$$$$$$$")

print(" What to do: ")

print("1. Add a record")

print("2. Show a record")

print("3. Update a record")

print("4. Delete a record")

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

if n == 1:

PAGE 10
add()

elif n == 2:

search()

elif n == 3:

update()

elif n == 4:

delete()

else:

print("Invalid input. Please try again.")

m= input("any tasks remaining?(Y/N)")

if m in 'Yy':

tasks()

tasks()

# Close the cursor and database connection

db.commit()

db.close()

PAGE 11
Outputs

PAGE 12
PAGE 13
PAGE 14
References

https://www.w3schools.com/

https://www.google.com/

https://www.wikipedia.org/

PAGE 15

You might also like