暂无图片
sqlite怎么在已有表上添加主键?
我来答
分享
仓管员
2021-12-22
sqlite怎么在已有表上添加主键?

sqlite怎么在已有表上添加主键?

我来答
添加附件
收藏
分享
问题补充
1条回答
默认
最新
chengang

官方文档给出的答案
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
暂无图片
仓管员
题主
2021-12-22
3Q
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏