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

一 、另外的那张表没有新建的时候,使用 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. 修改linux命令行提示符路径显示

    命令显示行太长,影响观感,这样需要修改,具体方法: 1. 修改 ~/.bashrc,在最后一行添加: export PS1='[\u@\h\W]$' 其中\u是当前用户名,\h是当前主机名,\w显示当 ...

  2. apk反编译(4)Smali代码注入

    转自 : http://blog.sina.com.cn/s/blog_5674d18801019i89.html 应用场景 Smali代码注入只能应对函数级别的移植,对于类级别的移植是无能为力的.具 ...

  3. myeclipse2014破解版本链接

    myeclipse2014破解版本下载链接 http://www.my-eclipse.cn/#download myeclipse2014破解版本汉化链接 https://blog.my-eclip ...

  4. 将Ftp添加到资源管理器中直接使用

    在资源管理器中,右键,添加网络位置. 然后输入ftp的url ftp://server2008 使用匿名方式登录

  5. Linux 下查看文件字符编码和转换编码

    Linux 下查看文件字符编码和转换编码 如果你需要在Linux中操作windows下的文件,那么你可能会经常遇到文件编码转换的问题.Windows中默认的文件格式是GBK(gb2312),而Linu ...

  6. 函数lock_rec_get_first

    /*********************************************************************//** Gets the first explicit l ...

  7. C#将HTML导出Excel

    首先这个 不能用ajax 操作,不过 我现在讲的 这个方法和ajax 的效果一样. 你在你需要导出的页面写个方法 function DaoChu () { location.href = " ...

  8. ADODB.Connection 错误 '800a0e7a' 未找到提供程序。该程序可能未正确安装。解决方法!

    [问题描述]调试基于ACCESS+ASP的网站程序的时候,遇到如下错误: ADODB.Connection 错误 '800a0e7a' 未找到提供程序.该程序可能未正确安装. /Inc/Functio ...

  9. ASP.NET MVC 学习4、Controller中添加SearchIndex页面,实现简单的查询功能

    参考:http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/examining-the-edit-method ...

  10. Codeforces Round #271 (Div. 2)

    A. Keyboard 题意:一个人打字,可能会左偏一位,可能会右偏一位,给出一串字符,求它本来的串 和紫书的破损的键盘一样 #include<iostream> #include< ...