select into from 和 insert into select都是用来复制表,

两者的主要区别为:

  select into from 要求目标表不存在,因为在插入时会自动创建。

  insert into select from 要求目标表存在

备份表数据:

  create table emp as select * from scott.emp

还原表数据:

  insert into emp select * from scott.emp

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

如果两个表结构不一样:

  insert into table_name_new(column1,column2...) select column1,column2... from table_name_old

select into from 和 insert into select的更多相关文章

  1. select into from 和 insert into select 的用法和区别

    select into from 和 insert into select都是用来复制表,两者的主要区别为: select into from 要求目标表不存在,因为在插入时会自动创建.insert ...

  2. select into from和insert into select from两种表复制语句区别

    select into from和insert into select from两种表复制语句都是将源表source_table的记录插入到目标表target_table,但两句又有区别. 第一句(s ...

  3. select into from 和 insert into select 的用法和区别(转)

    转自:http://www.studyofnet.com/news/182.html select into from 和 insert into select都是用来复制表,两者的主要区别为: se ...

  4. 表复制语句select into from 与 insert into select 区别鉴赏

    select into from 与 insert into select 区别鉴赏 1.INSERT INTO SELECT语句 语句形式为:Insert into Table2(field1,fi ...

  5. select into from 和 insert into select 的用法

    SELECT INTO 和 INSERT INTO SELECT 两种表复制语句 Insert是T-sql中常用语句,Insert INTO table(field1,field2,...) valu ...

  6. select into from 与 insert into select 区别

    1.INSERT INTO SELECT语句 语句形式为:Insert into Table2(field1,field2,...) select value1,value2,... from Tab ...

  7. 【oracle】select into from 和 insert into select 的用法和区别

    select into from 和 insert into select都是用来复制表,两者的主要区别为: select into from 要求目标表不存在,因为在插入时会自动创建.insert ...

  8. SELECT INTO FROM 与 INSERT INTO SELECT区别鉴赏

    .INSERT INTO SELECT语句 语句形式为:Insert into Table2(field1,field2,...) select value1,value2,... from Tabl ...

  9. select into from 和 insert into select 的区别和用法及 SQL SELECT INTO 中Undeclared variable错误解决办法

    今天试了一下数据表中的数据备份到另一个空的数据表,然后使用了SQL SELECT INTO语句,然后提示Undeclared variable......错误,现在在这里做下总结并给出解决办法. 应用 ...

随机推荐

  1. hibernate课程 初探单表映射4-1 课程总结

    ORM是一种面向对象编程的方法,用这种方法来避免写数据库底层语言sql语句,这样有利于java的跨平台,扩展.维护.而hirenate是ORM的一种框架 hirbernate开发基本步骤编写配置文档h ...

  2. 浅谈python的深浅拷贝

    python中有两种数据类型:一种是可变数据类型,一种是不可变数据类型 不可变数据类型包括(整型及其他数据类型,字符串及元组) 可变数据类型(列表,集合,字典,类和类实例) 鉴定是否为拷贝还是只是引用 ...

  3. 关于css实现单行、多行省略标记

    实现单行: overflow: hidden; text-overflow:ellipsis; white-space: nowrap; 实现多行: display: -webkit-box; -we ...

  4. Design Pattern ->Abstract Factory

    Layering & Contract Philosophy With additional indirection Abstract Factory //The example code i ...

  5. Razor 语法糖常规用法

    1.隐匿代码表达式 例: @model.name 会将表达式的值计算并写入到响应中,输入时采用html编码方式 2.显示表达式 例:@(model.name)会将输入@model.name字符串 3. ...

  6. [SVN]TortoiseSVN工具培训3─使用基本流程和图标说明

    1.SVN的使用基本流程 注意:对于文件编辑方面,上图的编辑副本操作前建议进行Get lock操作,以防出现后续的冲突等异常报错. 2.SVN的基本图标说明

  7. JDBC源码解析

    参考:https://blog.csdn.net/silviakafka/article/details/46225045

  8. python3线程介绍02(线程锁的介绍:互斥、信号、条件、时间、定时器)

    #!/usr/bin/env python# -*- coding:utf-8 -*- import threadingimport timeimport random # 1-互斥锁 Lock 同一 ...

  9. 基于FPGA的VGA显示设计(二)

    上一篇:基于FPGA的VGA显示设计(一)     参照 CrazyBingo 的 基于FPGA的VGA可移植模块终极设计代码  的工程代码风格,模块化处理了上一篇的代码,并增加了一点其它图形. 顶层 ...

  10. May 2 2017 Week 18 Tuesday

    The beauty of the journey is found in the scenery along the way. 旅行之美在于沿途所见的风景. Several years ago, I ...