-
Notifications
You must be signed in to change notification settings - Fork 276
Open
Description
import sqlite3
Database ချိတ်ဆက်ခြင်း
conn = sqlite3.connect('store_pos.db')
cursor = conn.cursor()
Table တည်ဆောက်ခြင်း
cursor.execute('''CREATE TABLE IF NOT EXISTS products
(id INTEGER PRIMARY KEY, name TEXT, price REAL, stock INTEGER)''')
ပစ္စည်းအသစ် ထည့်ခြင်း function
def add_product(name, price, stock):
cursor.execute("INSERT INTO products (name, price, stock) VALUES (?, ?, ?)", (name, price, stock))
conn.commit()
print(f"{name} ကို စာရင်းသွင်းပြီးပါပြီ။")
အရောင်းမှတ်တမ်းတင်ခြင်း (Stock လခြင်း)
def make_sale(product_id, qty):
cursor.execute("UPDATE products SET stock = stock - ? WHERE id = ?", (qty, product_id))
conn.commit()
print("အရောင်းအောင်မြင်ပါသည်။")
စမ်းသပ်ကြည့်ရန်
add_product("Coffee Mix", 500, 100)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels