Sqlite3 Cheatsheet For Python 3 GitHub
Sqlite3 Cheatsheet For Python 3 GitHub
7aman / sqlite3-in-python.py
Created 2 years ago
sqlite3-in-python.py
1 #!/usr/bin/env python3
2
3 '''
4 Thanks to Andres Torres
5 Source: https://www.pythoncentral.io/introduction-to-sqlite-in-python/
6 '''
7
8 import sqlite3
9
10 # Create a database in RAM
11 # db = sqlite3.connect(':memory:')
12
13 # Creates or opens a file called mydb with a SQLite3 DB
14 db = sqlite3.connect('db.sqlite3')
15
16 ##########
17 # CREATE #
18 ##########
19 cursor = db.cursor()
20 cursor.execute('''
21 CREATE TABLE IF NOT EXISTS users(
22 id INTEGER PRIMARY KEY,
23 name TEXT,
24 phone TEXT,
25 email TEXT,
26 password TEXT
27 )
28 ''')
29 db.commit()
30
31
Thanks a TON! :D
Thanks a TON! :D
you're welcome
Thank you!
Also you can give an example with INSERT OR IGNORE INTO.
Thanks!