hive--刪除表中的數據truncate

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>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章