sqlite3: creating table with no columns
you can create table with only id column instead of creating empty table:
def create_table(DATABESE_NAME):
conn = sqlite3.connect(DATABESE_NAME)
c = conn.cursor()
c.execute(''' CREATE TABLE IF NOT EXISTS rate_table(
id INTEGER PRIMARY KEY AUTOINCREMENT) ''')
conn.commit()
conn.close()
I had this same question because I wanted a table with only the rowid field. While you may not be able to create a table without columns, you can make a table with only a rowid field as the primary key using the following code:
CREATE TABLE tablename (rowid INTEGER PRIMARY KEY) WITHOUT ROWID;
Zero-column tables aren't supported in SQLite. Or in the SQL standard either.