I have checked out the other questions and answers similar to my issue but none are answering my issue so I hope it ok to ask:
I am getting the following error:
Caused by: android.database.sqlite.SQLiteException: near "Group": syntax error (code 1): , while compiling: CREATE TABLE my_locations_table (_id INTEGER PRIMARY KEY, Name TEXT NOT NULL, Group TEXT NOT NULL, Lat TEXT NOT NULL, Lng TEXT NOT NULL);
#################################################################
Error Code : 1 (SQLITE_ERROR)
Caused By : SQL(query) error or missing database.
(near "Group": syntax error (code 1): , while compiling: CREATE TABLE my_locations_table (_id INTEGER PRIMARY KEY, Name TEXT NOT NULL, Group TEXT NOT NULL, Lat TEXT NOT NULL, Lng TEXT NOT NULL);)
Here is my code:
private final static String KEY_ROWID = "_id";
private final static String KEY_NAME = "Name";
private final static String KEY_GROUP = "Group";
private final static String KEY_LAT = "Lat";
private final static String KEY_LNG = "Lng";
and the error is occurring at this point:
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + DATABASE_TABLE
+ " (" + KEY_ROWID + " INTEGER PRIMARY KEY, "
+ KEY_NAME + " TEXT NOT NULL, "
+ KEY_GROUP + " TEXT NOT NULL, "
+ KEY_LAT + " TEXT NOT NULL, "
+ KEY_LNG + " TEXT NOT NULL);");
}
After looking at this for hours now I can not see the issue?
GROUPis a keyword. Either quote it everywhere you use it as a column name, or call it something else.