问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
墨值悬赏
sqlite怎么在已有表上添加主键?
官方文档给出的答案
https://sqlite.org/faq.html#q11
How do I add, delete or rename columns from an existing table in SQLite?
SQLite has limited ALTER TABLE support that you can use to add, rename or drop columns or to change the name of a table as detailed at ALTER TABLE.
If you want to make more complex changes in the structure or constraints of a table or its columns, you will have to recreate it. You can save existing data to a temporary table, drop the old table, create the new table, then copy the data back in from the temporary table. See Making Other Kinds Of Table Schema Changes for procedure.
您可以将现有数据保存到临时表中,删除旧表,创建新表,然后将数据从临时表复制回
评论
有用 1
墨值悬赏