Issue
This is the code that works for adding a column.
mDb.execSQL("ALTER TABLE " + table_name +
" ADD COLUMN " + column_name + " text");
My problem the column is created at the last position of the table.
Column1|Column2|Column3|Column4|Column5|NewAddedColumn6
E.g. Is is possible to add a column between Column3
and Column4
???
Column1|Column2|Column3|NewAddedColumn6|Column4|Column5
Solution
As per the SQLite > ALTER TABLE > ADD COLUMN documentation:
The ADD COLUMN syntax is used to add a new column to an existing
table. The new column is always appended to the end of the list of
existing columns.
Hence, the answer to your question is NO.
However, there is a workaround. See this answer.
Answered By – Ravinder Reddy
Answer Checked By – David Goodson (FlutterFixes Volunteer)