android指定sqlite路径,Sqlite将列添加到表中的特定位置(Android)

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

解决方案

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值