简体   繁体   English

在MariaDB中更改列名称

[英]Change column name in MariaDB

I have this column in this database with a spacebar included, which I want to change. 我在此数据库的此列中包含一个空格键,我想对其进行更改。

ALTER TABLE . CHANGE COLUMN `Anzahl Personen` AnzahlPersonen int(11); 

After using this line in the command line the output is as following: 在命令行中使用此行之后,输出如下:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CHANGE COLUMN `Anzahl Personen` AnzahlPersonen int(11)' at line 1

Yeah, I have no Idea, what I am doing wrong. 是的,我不知道我在做什么错。

If you are using dot (.) instead of table name that is why you have error. 如果使用点号(。)代替表名,这就是错误的原因。 You have to specify table name: 您必须指定表名称:

ALTER TABLE `table_name` CHANGE COLUMN `Anzahl Personen` AnzahlPersonen int(11);

ALTER TABLE <table_name> CHANGE COLUMN old_name new_name column_definition

https://jira.mariadb.org/browse/MDEV-16290

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM