Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用sqlite时alter table drop列语法错误_Sqlite_Primary Key_Alter Table - Fatal编程技术网

使用sqlite时alter table drop列语法错误

使用sqlite时alter table drop列语法错误,sqlite,primary-key,alter-table,Sqlite,Primary Key,Alter Table,这是我的表的架构: create table LPCG(ID integer primary key, PCG text, Desc text, test text); 我希望删除“test”列,因此使用以下命令: alter table LPCG drop column test; 这是我收到的错误消息: Error: near "drop": syntax error 有人能帮我改正错误吗 另外一个问题是:我知道ID是主键属性。我能把那个专栏删掉吗?如果没有,是否有任何人使用过的解决方

这是我的表的架构:

create table LPCG(ID integer primary key, PCG text, Desc text, test text);
我希望删除“test”列,因此使用以下命令:

alter table LPCG drop column test;
这是我收到的错误消息:

Error: near "drop": syntax error
有人能帮我改正错误吗

另外一个问题是:我知道ID是主键属性。我能把那个专栏删掉吗?如果没有,是否有任何人使用过的解决方法

提前感谢您的帮助。

版本3.35之前。您只能重命名表或添加列

如果要删除列,最好的选择是创建一个不包含该列的新表,然后删除旧表以重命名新表


到目前为止,ALTER TABLE支持仍然有限,但包括在条件下删除列。

DROP column
在Sqlite的最新版本中受支持-请参阅