sqlite3 update table
You have two options. First,you could simply add a new column with the following: ALTER TABLE {tableName} ADD COLUMN COLNew {type}; Second,and more complicatedly,but would actually put the column where you want it,would be to rename the table: TABLE {tableName} RENAME TO TempOldTable; Then create the new table with the missing column: CREATE TABLE {tableName} (name TEXT, COLNew {type} DEFAULT {defaultValue}, qty INTEGER, rate REAL); And populate it with the old data: INSERT INTO {tableName} (name, qty, rate) SELECT name, rate FROM TempOldTable; Then delete the old table: DROP TABLE TempOldTable; I'd much prefer the second option,as it will allow you to completely rename everything if need be. http://stackoverflow.com/questions/4253804/insert-new-column-into-table-in-sqlite (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 是否存在将XML解析为Java对象的声明方法?
- c – 初始化静态库中嵌入的qt资源
- jstl隔行显示不同的背景色与ajax隔行显示不同的颜色
- 【COCOS2DX-LUA 脚本开发之十二】Hybrid模式-利用AssetsMan
- ruby-on-rails – 我怎样才能阻止faker gem在ruby on rails
- vb.net HtmlAgilityPack在div之后插入字符串
- 知道这20个正则表达式,能让你少写1,000行代码
- ruby-on-rails – Rails拖放和排序元素到nested_form
- ios – iphone 6 vs iphone 5 image Naming Convention
- ajax树及注意点