RENAME [TO] Home >Database >Mysql Tutorial >How to set table name in mysql? Mysql method to set the table name: use the alter table statement and use the SQL code "ALTER TABLE Description of requirements: Today I am migrating historical data of mysql tables and need to back up a certain table. , modify the name of the table, record the operation process here. Operation process: Note: The table name has been successfully modified. Official document syntax for modifying table name: The above is the detailed content of How to set table name in mysql?. For more information, please follow other related articles on the PHP Chinese website!How to set table name in mysql?
mysql> create table ts01 like ti_o_sms; #创建表结构.这样的建表方式,不仅仅是表的结构,连带着索引也会同时创建.
Query OK, 0 rows affected (0.02 sec)
mysql> alter table ts01 rename to ts01_new; #修改表名的语法:alter table rename to/as new_tablename;
Query OK, 0 rows affected (0.00 sec)
mysql> show tables;
+--------------------+
| Tables_in_mytest |
+--------------------+
| sms_send_blacklist |
| td_b_sendobject |
| ti_o_sms |
| ts01_new |
+--------------------+
4 rows in set (0.00 sec)或者
mysql> alter table ts01_new rename AS ts02;
Query OK, 0 rows affected (0.03 sec)
mysql> show tables;
+--------------------+
| Tables_in_mytest |
+--------------------+
| sms_send_blacklist |
| td_b_sendobject |
| ti_o_sms |
| ts02 |
+--------------------+
4 rows in set (0.00 sec
mysql help RENAME