insert into select和select into的使用和区别介绍

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

insert into select和select into的使用和区别介绍

  2020-12-16 我要评论
insert into ... select 和 select ... into的使用上有哪些区别呢?在本文将为大家下详细介绍下,不知道的朋友可以了解下
insert into ... select ...:可将表1中的全部数据或者部分数据复制到表2中。

eg:
复制代码 代码如下:

insert into t2(id,name,pwd)
select id,name,pwd from t1

注:t2必须存在。t1中查询的列名可不与t1列名相同。无 values

select...into:查询t1中的数据,插入到t2中。

eg:
复制代码 代码如下:

select * into t2 from t1

注:t2被创建并填充数据。

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们