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

编程入门 行业动态 更新时间:2024-10-21 16:08:17

select into from和insert into select from<a href=https://www.elefans.com/category/jswz/34/1768716.html style=两种表复制语句区别"/>

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

select into from和insert into select from两种表复制语句都是将源表source_table的记录插入到目标表target_table,但两句又有区别。
第一句(select into from)要求目标表target_table不存在,因为在插入时会自动创建。

select * into target_table from source_table;

第二句(insert into select from)要求目标表target_table存在,由于目标表已经存在,所以我们除了插入源表source_table的字段外,还可以插入常量。

insert into target_table(column1,column2) select column1,5 from source_table;

更多推荐

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

本文发布于:2024-03-10 13:48:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1728144.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:两种   语句   区别   select   insert

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!