The alter table command of SQLite allows you to rename or add new fields to an existing table. fields cannot be deleted from the table.
You can only add columns at the end of the table.
For example, add two columns for subscribe
Alter table subpartition add column activation blob;
Alter table subpartition add column key blob;
You can execute the following statement in a transaction to modify the table.
Change table name to temporary table
Alter table subpartition Rename to _ temp _ subpartition;
Create a new table
Create Table subpartition (orderid varchar (32) primary key, username varchar (32) not null, productid varchar (16) not null );
Import Data
Insert into subpartition select orderid, "", productid from _ temp _ subpartition;
Or
Insert into subpartition () Select orderid, "", productid from _ temp _ subpartition;
Note that double quotation marks (") are used to supplement data that does not exist.
Delete temporary table
Drop table _ temp _ subpartition;
Original article:Http://zhiwei.li/text/2010/06/sqlite-%E4%BF% AE %E6%94%B9%E8%A1%A8%E7%BB%93%E6%9E%84/