Advertisement
AtEchoOff

Setup Code for using SQLite3 on Replit

Jul 13th, 2024
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. import sqlite3
  2.  
  3. conn = sqlite3.connect("example.db")
  4. cursor = conn.cursor()
  5. sql = ''' CREATE TABLE people (
  6. id INTEGER PRIMARY_KEY AUTO_INCREMENT,
  7. firstName TEXT NOT NULL,
  8. lastName TEXT NOT NULL,
  9. age INTEGER NOT NULL
  10. )'''
  11.  
  12. cursor.execute(sql)
  13. conn.commit()
  14.  
  15. print(cursor.execute("SELECT * from people").fetchall())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement