Skip to content

Instantly share code, notes, and snippets.

@aniruddha27
Last active April 14, 2020 05:14
Show Gist options
  • Save aniruddha27/10067cd269694c722838f8dbbf5c7e59 to your computer and use it in GitHub Desktop.
Save aniruddha27/10067cd269694c722838f8dbbf5c7e59 to your computer and use it in GitHub Desktop.
# connect to existing database
conn = sqlite3.connect('.\sql_db\Demo_table.db')
cur = conn.cursor()
# create table in database
cur.execute('''CREATE TABLE CUSTOMER(
User_ID INTEGER PRIMARY KEY NOT NULL,
Product_ID INTEGER NOT NULL,
Name TEXT NOT NULL,
Gender TEXT NOT NULL,
AGE INTEGER NOT NULL,
CITY TEXT);
''')
# commit and save changes to database
conn.commit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment