Nov-25-2021, 03:55 AM
(This post was last modified: Nov-25-2021, 07:22 AM by Yoriz.
Edit Reason: Added code tags
)
Hello,
Do you see why I get the error:
python code is pasted below:
Do you see why I get the error:
Error:cursor.execute("""INSERT INTO Books(ID, Title, Author, DatePublished) VALUES("1", "De Profundis", "Oscar Wilde", "1905")""")
sqlite3.OperationalError: table Books has no column named DatePublished
------------------------------------------------------------------------------------------------------------------------------python code is pasted below:
import sqlite3 with sqlite3.connect("BookInfo.db") as db: cursor = db.cursor() cursor.execute(""" CREATE TABLE IF NOT EXISTS Books(ID integer PRIMARY KEY, Title text, Author text, DatePublished integer);""") cursor.execute("""INSERT INTO Books(ID, Title, Author, DatePublished) VALUES("1", "De Profundis", "Oscar Wilde", "1905")""") db.commit()