python-by-example-150-chall.../challenges139-145/challenge-139.py
2019-08-05 16:33:21 +03:00

13 lines
586 B
Python

import sqlite3
with sqlite3.connect('python-by-example') as db:
cursor = db.cursor()
cursor.execute("""CREATE TABLE IF NOT EXISTS employees(
id integer PRIMARY KEY,
name text NOT NULL,
dept text NOT NULL,
salary integer);""")
cursor.execute("""INSERT INTO employees(id,name,dept,salary)
VALUES("1","Bob","Sales","25000")""")
db.commit()