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只会覆盖一个分区,而不是整个表。
全部评论
这是什么时候会用的知识呀
相关推荐
2025-12-08 18:11
曲阜师范大学 Java
程序员花海_:实习和校招简历正确格式应该是教育背景+实习+项目经历+个人评价 其中项目经历注意要体现业务 实习经历里面的业务更是要自圆其说 简历模板尽可能保持干净整洁 不要太花哨的 点赞 评论 收藏
分享
点赞 评论 收藏
分享