Is there a way to create a table without an AUTOINCREMENT column?
I have tried the solution from this link, but it didn't work for me. prevent autoincrementing integer primary key?
public static final String KEY_ID = "ROW_ID";
public static final String BOOK = "books";
public static final String CAR = "cars";
private static final String BOOK_CAR_TABLE = "BOOK_CAR_Table";
private static final String[] ALL_KEYS = new String[] {KEY_ID, BOOK, CAR};
private static final String BOOK_CAR_CREATE =
"CREATE TABLE " + BOOK_CAR_TABLE + "("+
KEY_ID + " INTEGER PRIMARY KEY," +
BOOK + " TEXT," +
CAR + " TEXT)";
I understand that when I add INTEGER PRIMARY KEY, it will turn KEY_ID into an AUTOINCREMENT column.
public static final String KEY_ID = "ROW_ID";
public static final String BOOK = "books";
public static final String CAR = "cars";
private static final String BOOK_CAR_TABLE = "BOOK_CAR_Table";
private static final String[] ALL_KEYS = new String[] {KEY_ID, BOOK, CAR};
private static final String BOOK_CAR_CREATE =
"CREATE TABLE " + BOOK_CAR_TABLE + "("+
KEY_ID + " INTEGER," +
BOOK + " TEXT," +
CAR + " TEXT)";
the AUTOINCREMENT rowid column was created by itself, how did it happen ?????
I don't want this AUTOINCREMENT column.
How can I prevent this?
Thank you
Edit: added code
private static final String BOOK_CAR_CREATE =
"CREATE TABLE " + BOOK_CAR_TABLE + "("+
KEY_ID + " INTEGER," +
BOOK + " TEXT," +
CAR + " TEXT) WITHOUT ROWID";
I've tried this and it was force close. I guess it's because of the the SQLite version?