I have had a search about to try to understand the nature of this problem, but have not had any luck as of yet.
I'm making a RPG-style to-do list to teach myself Android/Java, and I'm making two tables: categories (strength, intelligence etc) and Quests: name, description, EXP etc.
I want each quest to have a category, but I'm getting a table constraints error. My code is below, and the GitHub link is here.
public void onCreate(SQLiteDatabase db){ setForeignKeyConstraintsEnabled(db); db.execSQL("CREATE TABLE " + CATEGORY_TABLE_NAME + "(id INTEGER primary key autoincrement NOT NULL, name TEXT, exp INTEGER, level INTEGER )"); db.execSQL("CREATE TABLE " + QUEST_TABLE_NAME + "(id INTEGER primary key autoincrement NOT NULL, name TEXT, description TEXT, expValue INTEGER, category INTEGER NOT NULL, FOREIGN KEY (category) REFERENCES categories (id), date TEXT"); db.execSQL("INSERT INTO " + CATEGORY_TABLE_NAME + "('name', 'exp', 'level') VALUES ('Strength', 0, 0 );"); db.execSQL("INSERT INTO " + CATEGORY_TABLE_NAME + "('name', 'exp', 'level') VALUES ('Stamina', 0, 0 );"); db.execSQL("INSERT INTO " + CATEGORY_TABLE_NAME + "('name', 'exp', 'level') VALUES ('Intelligence', 0, 0 );"); db.execSQL("INSERT INTO " + CATEGORY_TABLE_NAME + "('name', 'exp', 'level') VALUES ('Social', 0, 0 );"); db.execSQL("INSERT INTO " + QUEST_TABLE_NAME + "('name', 'description', 'expValue', 'category', 'date') VALUES ('Gym', 'Weightlifting down The Gym', '300', '1', '25/05/2017');"); } The error is coming at 'date TEXT', and the error says:
<table constraint> expected, got 'date'. What's the problem here?