您的位置:首页 > 数据库 > Oracle

Oracle 从旧表创建新表并复制旧表数据

2017-02-06 15:05 260 查看
create table test_temp2 as select * from test_temp where 1=0;
 

上面加了判断1=0 那么就没有插入数据。

不加判断的话,就也复制了数据

 

在mysql中试了一下,上面的语法也支持,但是区别是无法用drop table 删除掉有数据的表,在oracle中则可以。

只能先truncate table test_temp2,然后drop table  test_temp2。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: