CS Project File
CS Project File
1. Operating System
2. Python Installation
3. MySQL Database
SyStem requIrementS
if conn: c =
conn.cursor()
if choice == 1:
user_name = input('Enter your username: ')
password = input('Enter your password: ')
while True:
print('1. Customer details')
print('2. Product details')
print('3. Worker details')
print('4. See all customer
details') print('5. See all product
details') print('6. See all worker
details') print('7. See one
customer detail') print('8. See one
product detail') print('9. See one
worker detail') print('10. Stocks')
print('12. Exit')
if choice == 1:
cust_name = input('Enter your name: ') phone_no =
int(input('Enter your phone number: ')) cost =
float(input('Enter your Bill Amount: '))
sql_insert = "INSERT INTO customer_details VALUES
(%s, %s, %s)"
c.execute(sql_insert, (phone_no, cust_name, cost))
conn.commit() print('Data is updated
successfully!')
elif choice == 2:
product_name = input('Enter product name: ')
product_cost = float(input('Enter the MRP: '))
sql_insert = "INSERT INTO product_details VALUES
(%s, %s)"
c.execute(sql_insert, (product_name, product_cost))
conn.commit() print('Data is updated
successfully!')
elif choice == 3:
worker_name = input('Enter your name: ')
worker_work = input('Enter your work: ') worker_age
= int(input('Enter your age: ')) worker_salary =
float(input('Enter your salary: ')) phone_no =
int(input('Enter your phone number: ')) sql_insert
= "INSERT INTO worker_details VALUES
(%s, %s, %s, %s, %s)"
c.execute(sql_insert, (worker_name, worker_work,
worker_age, worker_salary, phone_no))
conn.commit() print('Data is updated
successfully!')
elif choice == 4: t =
conn.cursor()
t.execute('SELECT * FROM customer_details')
records = t.fetchall() for record in
records:
print(record)
elif choice == 5: t =
conn.cursor()
t.execute('SELECT * FROM product_details')
records = t.fetchall() for record in
records:
print(record)
elif choice == 6: t =
conn.cursor()
t.execute('SELECT * FROM worker_details')
records = t.fetchall() for record in
records: print(record)
elif choice == 7:
a = input('Enter the customer name: ') t
= "SELECT * FROM customer_details WHERE
cust_name = %s"
c.execute(t, (a,))
v = c.fetchall()
for record in v:
print(record)
elif choice == 8:
a = input('Enter product name: ') t =
"SELECT * FROM product_details WHERE
product_name = %s"
c.execute(t, (a,))
v = c.fetchall()
for record in v:
print(record)
elif choice == 9:
a = input('Enter the worker name: ') t
= "SELECT * FROM worker_details WHERE
worker_name = %s"
c.execute(t, (a,))
v = c.fetchall()
for record in v:
print(record)
elif choice == 2:
print('Exiting...')
else: print('Invalid choice. Please enter 1 or
2.')
conn.close()
else:
print("Failed to connect. Please check your database settings.")
outPutS
User authentication:-
Main Menu:-
tableS