sqlite3 update table
来源:互联网 发布:溺水 该去救人吗 知乎 编辑:程序博客网 时间:2024/06/05 00:43
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:
ALTER 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, qty, 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
- sqlite3 update table
- SQLite3 table 结构修改
- SQLite3 table 结构修改
- sqlite3 alter table
- update table with temprary table
- SQL 使用-Update table
- sql update two table
- TRY CATCH for update table
- Using KVO for Table Update
- rails update table using ajax
- PLSQL Trigger Update Another Table
- Batch update table name using *sp_rename*
- update any table in database by transcation
- insert update delete Table.aspx.cs
- 针对insert into update 的理解 深刻入理 sqlite3
- ios--低级错误--写错sqlite3的update语句
- sqlite3 update/insert/insert or replace对触发器的影响
- sql cursor update a table by another table
- java设计模式(六)观察者模式
- java设计模式(七)代理模式和java动态代理机制
- java设计模式(八)状态模式
- 博客计划搬家到CSDN了
- SqlServer2005备份模式与恢复模式
- sqlite3 update table
- 首次开淘宝被商家骗
- 深入理解writel 函数
- C语言实现推箱子游戏
- Android C2DM学习——云端推送
- Java 学习笔记20:深入Java的Cookie使用
- Chrome源码剖析【二】Chrome的进程间通信
- wireshark 基础教程
- jquery鼠标经过延时处理