sqlite3: creating table with no columns
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;
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()