HCatalog Drop Table
DROP TABLE statement is used to drip a table in HCatalog. When you drop a table from the metastore, it removes both the table and column data, as well as their associated metadata. HCatalog treats both normal tables (stored in the metastore) and external tables (stored in the local file system) in the same manner, regardless of their type.
Syntax -
DROP TABLE [IF EXISTS] [db_name.]table_name
The optional IF EXISTS clause allows the statement to succeed regardless of the table's existence. If the table exists, it is dropped; if it does not, the statement has no effect.
Example:
Assume we have a requirement to drop std_details_i from the Hcatalog. std_details_i table can be dropped by using the below DROP TABLE command -
./hcat e "DROP TABLE IF EXISTS std_db.std_details;"
On the successful completion of the above statement, the table std_details_i dropped from Hcatalog and provides the below response -
OK Time taken: 1.1 seconds