[英]Correct camelCase Column Name
I forget to change a column name from camel case to underscore style before creating the embedded db. 我忘了在创建嵌入式数据库之前将列名从驼峰式更改为下划线样式。 Typically, I would use
ALTER TABLE table_name RENAME "camelCase" TO underscore_style;
通常,我会使用
ALTER TABLE table_name RENAME "camelCase" TO underscore_style;
to rename the offending column. 重命名有问题的列。 However, that syntax errors out when I try to use it in this case.
但是,在这种情况下,当我尝试使用它时,该语法错误。
I also tried to create a new column and then copy the data, but the camelCase column name prompted an error. 我也尝试创建一个新列,然后复制数据,但是camelCase列名提示错误。
How can I correct my oversight? 我该如何纠正我的疏忽?
TIA TIA
Sorry, MonetDB[Lite] does not support renaming columns at this time. 抱歉,MonetDB [Lite]目前不支持重命名列。 What you can do is a workaround like this, say with table
foo
with columns a
and b
. 您可以做的是这样一种解决方法,比如说将表
foo
与列a
和b
。 You want to rename b
to c
: 您想将
b
重命名为c
:
CREATE TABLE foo (a INTEGER, b INTEGER);
ALTER TABLE foo ADD c INTEGER;
UPDATE foo SET c=b;
ALTER TABLE foo DROP b;
One drawback here is that the column order in the table can change. 这里的一个缺点是表中的列顺序可以更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.