<bdo id='yKSNn'></bdo><ul id='yKSNn'></ul>
      <legend id='yKSNn'><style id='yKSNn'><dir id='yKSNn'><q id='yKSNn'></q></dir></style></legend>

      <small id='yKSNn'></small><noframes id='yKSNn'>

        <tfoot id='yKSNn'></tfoot>

        <i id='yKSNn'><tr id='yKSNn'><dt id='yKSNn'><q id='yKSNn'><span id='yKSNn'><b id='yKSNn'><form id='yKSNn'><ins id='yKSNn'></ins><ul id='yKSNn'></ul><sub id='yKSNn'></sub></form><legend id='yKSNn'></legend><bdo id='yKSNn'><pre id='yKSNn'><center id='yKSNn'></center></pre></bdo></b><th id='yKSNn'></th></span></q></dt></tr></i><div id='yKSNn'><tfoot id='yKSNn'></tfoot><dl id='yKSNn'><fieldset id='yKSNn'></fieldset></dl></div>

        从 SQLite 表中删除列

        Delete column from SQLite table(从 SQLite 表中删除列)

        <small id='3KNV8'></small><noframes id='3KNV8'>

          <tbody id='3KNV8'></tbody>
      1. <tfoot id='3KNV8'></tfoot>

        1. <legend id='3KNV8'><style id='3KNV8'><dir id='3KNV8'><q id='3KNV8'></q></dir></style></legend>
        2. <i id='3KNV8'><tr id='3KNV8'><dt id='3KNV8'><q id='3KNV8'><span id='3KNV8'><b id='3KNV8'><form id='3KNV8'><ins id='3KNV8'></ins><ul id='3KNV8'></ul><sub id='3KNV8'></sub></form><legend id='3KNV8'></legend><bdo id='3KNV8'><pre id='3KNV8'><center id='3KNV8'></center></pre></bdo></b><th id='3KNV8'></th></span></q></dt></tr></i><div id='3KNV8'><tfoot id='3KNV8'></tfoot><dl id='3KNV8'><fieldset id='3KNV8'></fieldset></dl></div>

                  <bdo id='3KNV8'></bdo><ul id='3KNV8'></ul>

                  本文介绍了从 SQLite 表中删除列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个问题:我需要从我的 SQLite 数据库中删除一列.我写了这个查询

                  alter table table_name drop column column_name

                  但它不起作用.请帮帮我.

                  解决方案

                  更新:SQLite 2021-03-12 (3.35.0) 现在支持 DROP COLUMN.网站上的常见问题解答仍然过时.


                  来自:http://www.sqlite.org/faq.html:><块引用>

                  (11) 如何在 SQLite 中的现有表中添加或删除列.

                  SQLite 具有有限的 ALTER TABLE 支持,您可以使用它来添加列到表的末尾或更改表的名称.如果你想要对表的结构进行更复杂的更改,您将不得不重新创建表.您可以将现有数据保存到临时表,删除旧表,创建新表,然后复制数据从临时表返回.

                  例如,假设您有一个名为t1"的表.带列名a"、b"和c"并且您要删除列c";由此桌子.以下步骤说明了如何做到这一点:

                  开始交易;创建临时表 t1_backup(a,b);INSERT INTO t1_backup SELECT a,b FROM t1;删除表 t1;创建表 t1(a,b);INSERT INTO t1 SELECT a,b FROM t1_backup;删除表 t1_backup;犯罪;

                  I have a problem: I need to delete a column from my SQLite database. I wrote this query

                  alter table table_name drop column column_name 
                  

                  but it does not work. Please help me.

                  解决方案

                  Update: SQLite 2021-03-12 (3.35.0) now supports DROP COLUMN. The FAQ on the website is still outdated.


                  From: 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:

                  BEGIN TRANSACTION;
                  CREATE TEMPORARY TABLE t1_backup(a,b);
                  INSERT INTO t1_backup SELECT a,b FROM t1;
                  DROP TABLE t1;
                  CREATE TABLE t1(a,b);
                  INSERT INTO t1 SELECT a,b FROM t1_backup;
                  DROP TABLE t1_backup;
                  COMMIT;
                  

                  这篇关于从 SQLite 表中删除列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                  SQL query to group by day(按天分组的 SQL 查询)
                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Include missing months in Group By query(在 Group By 查询中包含缺失的月份)

                    <tfoot id='JpM10'></tfoot>

                    <i id='JpM10'><tr id='JpM10'><dt id='JpM10'><q id='JpM10'><span id='JpM10'><b id='JpM10'><form id='JpM10'><ins id='JpM10'></ins><ul id='JpM10'></ul><sub id='JpM10'></sub></form><legend id='JpM10'></legend><bdo id='JpM10'><pre id='JpM10'><center id='JpM10'></center></pre></bdo></b><th id='JpM10'></th></span></q></dt></tr></i><div id='JpM10'><tfoot id='JpM10'></tfoot><dl id='JpM10'><fieldset id='JpM10'></fieldset></dl></div>

                    <small id='JpM10'></small><noframes id='JpM10'>

                        <legend id='JpM10'><style id='JpM10'><dir id='JpM10'><q id='JpM10'></q></dir></style></legend>
                          <tbody id='JpM10'></tbody>
                          • <bdo id='JpM10'></bdo><ul id='JpM10'></ul>