Reputation: 11
The following code shows up this error when run.
INTEGER PRIMARY KEY LadID)""".format(usr))
sqlite3.OperationalError: near "LadID": syntax error
c.execute("""CREATE TABLE {}
(LadID INTEGER,
foreName TEXT,
surname TEXT,
interests INTEGER,
gender TEXT,
mob INTEGER
INTEGER PRIMARY KEY (LadID))""".format(usr))
What is the solution?
Upvotes: 1
Views: 449
Reputation: 107287
Seems that you have omitted a comma after mob INTEGER
also you need to change the last column to LadID INTEGER PRIMARY KEY
.
Note that you should put your column name at the start of column definition and don't need to parenthesis.
c.execute("""CREATE TABLE {}
(LadID INTEGER,
foreName TEXT,
surname TEXT,
interests INTEGER,
gender TEXT,
mob INTEGER,
LadID INTEGER PRIMARY KEY)""".format(usr))
Upvotes: 1