加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

从SQLite表中删除列

发布时间:2020-12-12 19:20:40 所属栏目:百科 来源:网络整理
导读:我有一个问题:我需要从我的SQLite数据库中删除一个列。我写了这个查询 alter table table_name drop column column_name 但它不工作。请帮帮我。 来自: http://www.sqlite.org/faq.html: (11) How do I add or delete columns from an existing table in
我有一个问题:我需要从我的SQLite数据库中删除一个列。我写了这个查询
alter table table_name drop column column_name

但它不工作。请帮帮我。

来自: http://www.sqlite.org/faq.html:

(11) How do I add or delete columns from an existing table in SQLite.

SQLite has limited ALTER TABLE support that you can use to add a
column to the end of a table or to change the name of a table. If you
want to make more complex changes in the structure of a table,you
will have to recreate the table. 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.

For example,suppose you have a table named “t1” with columns names
“a”,“b”,and “c” and that you want to delete column “c” from this
table. The following steps illustrate how this could be done:

06000

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读