Python Forum

Full Version: Creating a table in SQLite3
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm attempting to use the following piece of code to create a table in an SQLite3 database

cursor.execute("""CREATE TABLE IF NOT EXISTS Authors(Name text PRIMARY KEY, 
PlaceofBirth text NOT NULL,);""") # creates the Authors table with Name and PoB as fields
But I get this error:

Error:
File "c:/Users/djwil/Documents/python/learning python/Chapter 18 - SQLite/Ch18-c3.py", line 6, in <module> cursor.execute("""CREATE TABLE IF NOT EXISTS Authors(Name text PRIMARY KEY, sqlite3.OperationalError: near ")": syntax error
Can anyone offer any advice
What is the trailing ',' for after "NOT NULL"?
I got rid that and that solved the issue so thanks as lot :)