检索一个表中的部分行存到另一张表中。

一 、另外的那张表没有新建的时候,使用 select XXX into,创建的表与原表有相同的列名和类型:

select *
into Departments_Copy
from Departments
where Departments.ID>100

二、另外的那张表已经新建的时候,使用Insert into XXX select:

insert into Departments_Copy
select *
from Departments

select XXX into 和 Insert into XXX select的更多相关文章

  1. 拒绝了对对象 'data'(数据库 'xxx',所有者 'dbo')的 SELECT 权限

    拒绝了对对象 'data'(数据库 'xxx',所有者 'dbo')的 SELECT 权限解决的方法:1>在数据库里相应的用户权限中,把db_denydatareader的复选框的勾去掉.很多初 ...

  2. PostgreSQL simple select(group by and insert into ...select)

    warehouse_db=# create table student(number int primary key,name varchar(20),age int);CREATE TABLEwar ...

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

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

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

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

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

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

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

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

  7. Mysql中Insert into xxx on duplicate key update问题

    要点:Insert into xxx on duplicate key update可以在唯一索引重复的情况下,进行更新操作.           (1) 插入里边的字段应该只有一个 唯一索引:   ...

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

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

  9. select into from和insert into from

    最近在研究oracle function 时发现select into from和insert into from,这样的语句,于是上网查阅资料学习了一下, 原来两种表达式均可以达到复制整个表或表的一 ...

随机推荐

  1. brew命令

    下面参考下网友的总结: 查看brew的帮助 brew –help 安装软件 brew install git 卸载软件 brew uninstall git 搜索软件 brew search git ...

  2. Spring两种实现AOP的方式

    有两种实现AOP的方式:xml配置文件的方式和注解的形式 我们知道通知Advice是指对拦截到的方法做什么事,可以细分为 前置通知:方法执行之前执行的行为. 后置通知:方法执行之后执行的行为. 异常通 ...

  3. 62. Unique Paths

    题目: A robot is located at the top-left corner of a m x ngrid (marked 'Start' in the diagram below). ...

  4. js问题总结

    .removeClass(" ") 移除一个css样式 $("#popUpBox i").removeClass("channel_icon" ...

  5. Lists of network protocols

    https://en.wikipedia.org/wiki/Lists_of_network_protocols Protocol stack: List of network protocol st ...

  6. 1742. Team building(dfs)

    1742 最小的是找联通块数 最大的找环 一个环算一个 其它的数各算一个 #include <iostream> #include<cstdio> #include<cs ...

  7. ASP.NET 共用类库1

    using System; using System.Collections.Generic; using System.Text; using System.Web; using System.We ...

  8. string.Format 里面包含 javascript方法参数的时候 单引号变成双引号的问题解决方法

    解决方法如下 StringBuilder sb = new StringBuilder(); var str =@"<label><input type='checkbox ...

  9. windows 下使用 MinGW + msys 编译 ffmpeg

    本文参考了网络上的不少文章,但由于版本环境的问题参考文章并不能直接指导编译,本文吸收多方经验,并在自己多次编译实验的基础上写成,欢迎转载,请注名出处.    FFmpeg是在Linux平台下开发的,但 ...

  10. 【转】android:layout_gravity和android:gravity的区别

    1.首先来看看android:layout_gravity和android:gravity的使用区别. android:gravity: 这个是针对控件里的元素来说的,用来控制元素在该控件里的显示位置 ...