大家好,又见面了,我是你们的朋友全栈君。
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> 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```
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/138401.html原文链接:https://javaforall.cn