This really is most likely an exotic question however i weren't capable of finding the solution yet.
I wish to make use of a TEXT column with my very own unique names because the primary type in a table. the small portion of code to define this looks something similar to this during my project:
...blahblah..."CREATE TABLE " + CAT_BUD_TAB + " (" + CAT_ITEM_ID + "_ID TEXT PRIMARY KEY, "...blahblah..
Will the work when i intend? Or possibly i have to use "AS ID"? I only ever see single tables with _ID being an autoincrementing integer in. Also it was supposed to have been an overseas type in another table consider i designed my database i have find out more information and i am unsure that'll really matter using android &lifier SQLITE?
Because of the posters below but i am a bit slow and never confident that i am using the data right, would you check?
Therefore if i've got a create statement such as this:
"CREATE TABLE " + CAT_BUD_TAB + " (" + CAT_ITEM_ID + " TEXT PRIMARY KEY, " + IN_OUT + " TEXT, " + BUDGET_AMOUNT + " REAL, " + ACTUAL_AMOUNT_SPENT + " REAL, " + AMOUNT_STRAYED + " REAL, " + OVERBUDGET_TF + " INTEGER, " + AUTOSPEND_TF + " INTEGER);"
Then have: db.execSQL("Choose ID, ID AS CAT_ITEM_ID")
Can one then rely on them interchangeably? shall we be held even anywhere near close? haha sorry i'm trying!
You could have anything you like because the primary key.
But when you for example desire to use a CursorAdapter that instantly shows products from the Cursor-query you must have an integer column known as _ID because this is used here.
But when this isn't something you intend to make use of together with your table, that you can do what you would like!
You may create and define tables as you want, but when you'll have to make use of the table using a CursorAdapter that will not work with no tweak.
CursorAdapter: The Cursor must include a column named "_id" or this class will not work.
You have to always problem a
select col1 as _id ... to operate.
Therefore it is suggested to make use of
_id within the table schema, and when you love to use by another title you can this this.
select _id, _id as customname ... so choose the _id column two times with various names.