现在的位置: 首页 > 综合 > 正文

表数据的copy,insert into select/select into from

2018年02月04日 ⁄ 综合 ⁄ 共 330字 ⁄ 字号 评论关闭
  1. insert into select
  • 语句形式为:Insert into Table2(field1,field2,...) select value1,value2,... fromTable1

  • 要求
  1.  

    • 目标表必须存在
    • 除了可以插入源表外还能插入常量

      2. select into from

  •  语句形式:SELECTvale1, value2 into Table2 from Table1
  • 要求
    • 目标表不存在
      
        3. 既复制表结构也复制表内容的SQL语句:CREATE TABLE tab_new AS SELECT * FROM tab_old;

         4. 只复制表结构不复制表内容的SQL语句:CREATE TABLE tab_new AS SELECT * FROM tab_old WHERE 1=2

 

抱歉!评论已关闭.