Skip to content

Instantly share code, notes, and snippets.

@tomlin7
Created December 26, 2020 07:16
Show Gist options
  • Save tomlin7/eb70c5992d8d1dd53fd77461a3b71028 to your computer and use it in GitHub Desktop.
Save tomlin7/eb70c5992d8d1dd53fd77461a3b71028 to your computer and use it in GitHub Desktop.
Create an sqlite database & table and insert data to it
import sqlite3
db = sqlite3.connect('scores.db')
c = db.cursor()
c.execute('''CREATE TABLE stocks
(date text, trans text, symbol text, qty real, price real)''')
c.execute("INSERT INTO stocks VALUES ('2006-01-05','BUY','RHAT',100,35.14)")
db.commit()
db.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment