Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of modifying Field name by mysql

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report