Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sqlite3, random
- conn = sqlite3.connect("my_database.db")
- cursor = conn.cursor()
- try:
- cursor.execute("""CREATE TABLE cotrud
- (id integer, name text, is_work text, date_birst text, professia text)
- """)
- except Exception:
- pass
- def ad():
- name = input()
- is_work = input()
- date_birst = input()
- professia = input()
- cursor.execute(f"""INSERT INTO cotrud
- VALUES ({random.randint(1,1000000000)}, '{name}', '{is_work}', '{date_birst}', '{professia}')"""
- )
- conn.commit()
- def dell():
- sql = f"DELETE FROM cotrud WHERE id = {int(input())}"
- cursor.execute(sql)
- conn.commit()
- def reed():
- sql = "SELECT * FROM cotrud"
- cursor.execute(sql)
- print(cursor.fetchall())
- def sorterow():
- name = input()
- sql = f"SELECT * FROM cotrud ORDER BY {name}"
- cursor.execute(sql)
- print(cursor.fetchall())
- breakpoint()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement