1. 复制表结构及其数据:
create table table_name_new as select * from table_name_old复制代码
2. 只复制表结构:
create table table_name_new as select * from table_name_old where 1=2;复制代码
或者:
create table table_name_new like table_name_old复制代码
3. 只复制表数据:
如果两个表结构一样:
insert into table_name_new select * from table_name_old复制代码
如果两个表结构不一样:
<p style="margin: 10px auto; ">insert into table_name_new(column1,column2...) select column1,column2... from table_name_old</p>pasting复制代码
使用道具 举报
本版积分规则 发表回复 回帖并转播 回帖后跳转到最后一页
|小黑屋|手机版|IPiaoBo Inc. ( 渝ICP备17002826号 )
GMT+8, 2025-5-6 21:56 , Processed in 0.095564 second(s), 48 queries .
Powered by Discuz! X3.4
Copyright © 2001-2020, Tencent Cloud.