Hive 的insert into 和 insert overwrite
1、insert into 语句
Hive> insert into table account select id,age,name from account_tmp;
2、insert overwrite语句
hive> insert overwrite table account2 select id,age,name from account_tmp;
插入的数据: 001 20 zhangsan
两者的区别:
insert overwrite 会覆盖已经存在的数据,假如原始表使用overwrite 上述的数据,先现将原始表的数据remove,再插入新数据。最后表的数据 只有001 20 zhangsan这一条记录。
insert into 只是简单的插入,不考虑原始表的数据,直接追加到表中。最后表的数据是原始数据和新插入的 001 20 zhangsan
补充:如果是分区表,overwrite只会覆盖一个分区,而不是整个表。
1、insert into 语句
Hive> insert into table account select id,age,name from account_tmp;
2、insert overwrite语句
hive> insert overwrite table account2 select id,age,name from account_tmp;
插入的数据: 001 20 zhangsan
两者的区别:
insert overwrite 会覆盖已经存在的数据,假如原始表使用overwrite 上述的数据,先现将原始表的数据remove,再插入新数据。最后表的数据 只有001 20 zhangsan这一条记录。
insert into 只是简单的插入,不考虑原始表的数据,直接追加到表中。最后表的数据是原始数据和新插入的 001 20 zhangsan
补充:如果是分区表,overwrite只会覆盖一个分区,而不是整个表。
全部评论
这是什么时候会用的知识呀
相关推荐
07-09 13:39
门头沟学院 Java 点赞 评论 收藏
分享
点赞 评论 收藏
分享
白金之星世界:坏了,我俩一模一样,就连学校也都是双一流
]。我是从六月二十几号开始学的,跟的是优雅的路线。javase学完,现在在学mysql。每天学七八个小时,但还是挺充实的。不管时间够不够,反正先学起来。加油

查看图片

点赞 评论 收藏
分享