Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sqlite3
- from employee import employee
- def create_employee_table():
- connection = sqlite3.connect("employee.db")
- connection_cursor = connection.cursor()
- connection_cursor.execute("""CREATE TABLE IF NOT EXIST EMPLOYEE(
- id integer PRIMARY KEY AUTOINCREMENT,
- first_name text,
- last_name text,
- pay_roll integer
- )""")
- connection.commit()
- connection.close()
- def create_employee():
- connection = sqlite3.connect("employee.db")
- connection_cursor = connection.cursor()
- connection_cursor.execute("""INSERT INTO employees VALUES (first_name text, last_name text, pay_roll)
- VALUES ('Vytautas', 'Ragaisis', '7000')""")
- connection.commit()
- connection.close()
- create_employee()
- def select_employee_table():
- connection = sqlite3.connect("employee.db")
- connection_cursor = connection.cursor()
- connection_cursor.execute("""SELECT * FROM EMPLOYEE
- """)
- connection.commit()
- connection.close()
- def update_employee():
- connection = sqlite3.connect("employee.db")
- connection_cursor = connection.cursor()
- connection_cursor.execute("""UPDATE FROM EMPLOYEE,
- SET first_name = 'Vytautas',
- SET last_name = 'Ragaisis'
- """)
- connection.commit()
- connection.close()
- def delete_employee():
- connection = sqlite3.connect("employee.db")
- connection_cursor = connection.cursor()
- connection_cursor.execute("""DELETE FROM EMPLOYEE,
- WHERE 'Vytautas'
- """)
- connection.commit()
- connection.close()
- delete_employee()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement