插入语句

卡户人表的插入语句

insert into dwt.t_mk_custer_info PARTITION(dt='20211217') select

~,

~,

from dwt.t_mk_custer_info where dt='20211216' and custr_nbr='~~~~';

语法:inert into [表名1] partition(dt='时间') select * from [表名2] where ……

解释:把表2的数据插入到表1中,需要判断表1是否为分区表(show create table [表名]),

不是分区表不需要加partition. 如果表1中字段值需要修改,则需要把表1所有字段列出来,

表1和表2的字段数需要保持一致且一一对应。

表1中需要修改的字段需要替换原字段,并且用单引号引起来。

表2有限度条件,比如日期,身份证号等,需要加上where条件

 

 

 

posted on 2022-03-13 16:59  粉粉甜柚  阅读(202)  评论(0)    收藏  举报