Get the App
SLTechnology News&Howtos  ›  Database  › 

The method of modifying Field name by mysql

Shulou Source: shulou.com Published: 2022-06-01 03:13:55 09月11日 Update

This article will explain in detail the method of modifying field names in mysql. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Mysql method to modify the field name: [ALTER TABLE table name CHANGE [column] old field name new field name new data type;]. If you want to change the table name, you can execute the [ALTER TABLE old table name RENAME TO new table name;] statement.

Mysql modify the field name:

ALTER TABLE table name CHANGE [column] Old field name new field name new data type; mysql > alter table white_user change column name nick_name varchar (50) null comment 'nickname';-- correct Query OK, 0 rows affected (0.02 sec) Records: 0 Duplicates: 0 Warnings: 0

Mysql modifies the table name

ALTER TABLE old table name RENAME TO new table name; 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) the method of modifying field names in mysql is shared here. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Fields methods data more articles types good practical content articles nicknames knowledge statements references help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Huawei MySQL vpn NVidia