Sqlite Add Column into table at a certain position (Android)

前端 未结 1 1709
名媛妹妹
名媛妹妹 2021-02-14 03:19

This is the code that works for adding a column.

mDb.execSQL(\"ALTER TABLE \" + table_name + 
            \" ADD COLUMN \" + column_name + \" text\");

相关标签:
1条回答
  • 2021-02-14 03:48

    As per 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, answer to your question is NO

    But, there is a work around way.
    Read this answer on SO.

    Refer to: SQLite: ALTER TABLE: ADD COLUMN

    0 讨论(0)
提交回复
热议问题