insert into
众所周知,insert into作为插入语句,用来向表插入指定数据。语法如下:
insert into [表名] [列1,列2.....] value( [值1,值2......] )
也可以插入查询的数据,通常用来做数据的转移、清洗、降维,语法如下:
insert into [目标表名] ( [列1,列2.....] )
select [列1,列2.....] from [原始表名]
这种方式要求目标表必须存在。
select into
作为另一种复制表数据的手段,其得到的结果与上述的insert into select是一样。
不过select into不要求目标表存在,目标表会在查询过程中自动创建。
select [列1,列2.....] into [目标表名] from [原始表名]
网友评论