Mysql method to modify field names: [ALTER TABLE table name CHANGE[column] old field name new field name new data type;]. If you want to modify the table name, you can execute the [ALTER TABLE old table name RENAME TO new table name;] statement.
mysql Modify field name:
(Recommended tutorial: mysql tutorial)
ALTER TABLE 表名 CHANGE [column] 旧字段名 新字段名 新数据类型; mysql> alter table white_user change column name nick_name varchar(50) null comment '昵称'; -- 正确 Query OK, 0 rows affected (0.02 sec) Records: 0 Duplicates: 0 Warnings: 0
mysql Modify table name
ALTER TABLE 旧表名 RENAME TO 新表名 ; mysql> show tables ; +-------------------+ | Tables_in_db_test | +-------------------+ | white_user | +-------------------+ 1 row in set (0.00 sec) mysql> alter table white_user rename to white_user_new ; Query OK, 0 rows affected (0.00 sec) mysql> show tables ; +-------------------+ | Tables_in_db_test | +-------------------+ | white_user_new | +-------------------+ 1 row in set (0.00 sec)
Related recommendations:php training
The above is the detailed content of How to modify field name in mysql. For more information, please follow other related articles on the PHP Chinese website!