[我插入几行后,Alter table命令在mysql中不起作用

问题描述 投票:0回答:2
mysql> select * from ATRs;
+-----+-------------+---------------+-------+----------+
| Id  | Name_       | Team          | Goals | Trophies |
+-----+-------------+---------------+-------+----------+
| 110 | Messi       | Barcelona     |   699 |        0 |
| 107 | Ronaldo     | Juventus      |    60 |        0 |
| 107 | Ronaldo     | Real Madrid   |    60 |        0 |
| 109 | Lewandowski | Bayern Munich |   400 |       10 |
| 109 | Lewansowski | Dortmund      |    88 |        4 |
| 210 | Neymar      | Barcelona     |   121 |        9 |
| 210 | Neymar      | Paris         |    48 |        1 |
+-----+-------------+---------------+-------+----------+
7 rows in set (0.00 sec)

这是我现在的桌子

alter table ATRs change Name_ Name varchar(22);

在执行此命令后,服务器完全不响应,之后写的任何内容都被视为纯文本。

mysql sql alter-table
2个回答
0
投票

请重命名列,而不要更改

ALTER TABLE ATRs RENAME COLUMN Name_ TO Name;

0
投票

如果要更改列,则应先截断表。尝试重命名它或在更改之前截断表。

© www.soinside.com 2019 - 2024. All rights reserved.