Apr-30-2022, 12:16 AM
Hello,
I created this table:
Any help would be greatly appreciated.
Thanks.
P.S
Also, I do happen to have another question. How would I go about displaying the records in the database (once I add some)?
I know I'll need a for loop and a select statement but I don't know how to mix them together to get it to work.
(Also any good tutorials for SQLite with python that you can point me to would be appreciated as well. I'm familiar with MySQl but it's been a while. I don't know if SQLite is much different.)
I created this table:
import sqlite3 #Create a database (inventory.db) connection = sqlite3.connect("inventory.db") cursor = connection.cursor() cursor.execute('''CREATE TABLE Items (ID INT PRIMARY KEY NOT NULL, NAME TEXT NOT NULL, Image BLOB, Quantity TEXT NOT NULL, Price DOUBLE NOT NULL, Sell Price DOUBLE, Location TEXT NOT NULL, Description TEXT, Category TEXT, Length(Ft) INT, Brightness TEXT, Rating TEXT, Torque TEXT, Date Updated timestamp);''') #Commit the changes connection.commit() #Close the connection connection.close()And when I run the script I get:
Error:Traceback (most recent call last):
File "SQLite_Database.py", line 21, in <module>
Date Updated timestamp);''')
sqlite3.OperationalError: near "(": syntax error
This is starting to drive me mad because I can't seem to figure it outAny help would be greatly appreciated.
Thanks.
P.S
Also, I do happen to have another question. How would I go about displaying the records in the database (once I add some)?
I know I'll need a for loop and a select statement but I don't know how to mix them together to get it to work.
(Also any good tutorials for SQLite with python that you can point me to would be appreciated as well. I'm familiar with MySQl but it's been a while. I don't know if SQLite is much different.)