hive--删除表中的数据truncate

来源:互联网 发布:乐乎的拼音 编辑:程序博客网 时间:2024/06/05 17:52

delect:用于删除特定行条件,你可以从给定表中删除所有的行

TRUNCATE:truncate用于删除所有的行,这个行为在hive元存储删除数据是不可逆的

DROP:删除hive中的表


truncate 不能删除外部表!因为外部表里的数据并不是存放在Hive中的warehouse中

truncate table table_name;

例子:

truncate table employees;


另外一种方法:

<span style="font-size: 18px; color: rgb(85, 85, 85); font-family: "microsoft yahei"; line-height: 35px; background-color: rgb(255, 255, 255);">insert overwrite table table_name select * from table_name where 1=0;</span>
0 0