我是一个java开发者,我的文章,没有华丽的言辞,没有666的版式,这些都是我自己工作中用到的解决方案,很多都是直接粘贴的源码,在这里与君分享。如果喜欢这里文章可以关注我,我回继续发的,谢谢你。
说明:条件1=1肯定成立,表示备份数据和表结构,1=2则不成立,只备份表结构
1.Sql Server
select * into newtableName from oldTableName Where 1=1; 备份表结构和数据
select * into newtableName from oldTableName Where 1=2; 备份表结构
2. Oracle 3种方法
create table newTableName as select * from oldTableName where 1=1;备份表和数据
select * into newtableName from oldTableName Where 1=1; 备份表和数据
insert into newtableName select * from oldTableName Where 1=1; 备份表和数据
3.Mysql
create table newTableName as select * from oldTableName where 1=1;备份表和数据