Let us understand how to truncate tables.
- TRUNCATE works only for managed tables. Only data will be deleted, structure will be retained.
- Launch hive (we cannot use database as database is dropped)
CREATE DATABASE training_retail; CREATE TABLE orders ( order_id INT, order_date STRING, order_customer_id INT, order_status STRING ) ROW FORMAT DELIMITED FIELDS TERMINATED BY ','; LOAD DATA LOCAL INPATH '/data/retail_db/orders' INTO TABLE orders; SELECT * FROM orders LIMIT 10; TRUNCATE TABLE orders;