Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import mysql.connector as mc
- cnx = mc.connect(host="localhost", user="alen", password="alen", database="joseph_project")
- cur = cnx.cursor()
- def connection():
- if cnx.is_connected():
- return 1
- c = connection()
- if c == 1:
- print("Electronic Shop System")
- print("1. Items")
- print("2. Labours")
- print("3. Customers")
- print("4. Sales")
- print("5. Expenses")
- try:
- cur.execute("CREATE TABLE ITEMS(S_NO INT PRIMARY KEY, ITEM VARCHAR(50), AVAILABLE BOOLEAN, STOCK INT, PRICE INT)")
- cur.execute("CREATE TABLE LABOURS(NAME VARCHAR(25) PRIMARY KEY, AGE INT, PLACE VARCHAR(40), DEPARTMENT VARCHAR(20))")
- cur.execute("CREATE TABLE CUSTOMER(SNO INT PRIMARY KEY, CNAME VARCHAR(50), AGE INT, PLACE VARCHAR(30), ITEM_BOUGHT VARCHAR(25))")
- cnx.commit()
- except:
- print("Table Created")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement