Please tell me how to delete table from hive and also tell from where i can get more information about hive queries.
Asked
Active
Viewed 1.6e+01k times
3 Answers
31
You can use drop command to delete meta data and actual data from HDFS.
And just to delete data and keep the table structure, use truncate command.
For further help regarding hive ql, check language manual of hive.

harschware
- 13,006
- 17
- 55
- 87

Balaswamy Vaddeman
- 8,360
- 3
- 30
- 40
-
2Hive version 0.11 will support `TRUNCATE`. The documentation link provided in this answer is also out of date. Use [this](https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL). – Jake Z Oct 09 '13 at 18:51
12
To Truncate:
hive -e "TRUNCATE TABLE IF EXISTS $tablename"
To Drop:
hive -e "Drop TABLE IF EXISTS $tablename"

Petter Friberg
- 21,252
- 9
- 60
- 109

Anoop Velluva
- 329
- 2
- 9
6
Use the following to delete all the tables in a linux environment.
hive -e 'show tables' | xargs -I '{}' hive -e 'drop table {}'

Abimaran Kugathasan
- 31,165
- 11
- 75
- 105