In Hive, Managed tables / Internal table are Hive owned tables and the tables data are managed and controlled by Hive. If a Managed table or its partition is dropped, the data and metadata associated with that table or partition are deleted permanently.
External tables are tables where Hive has loose coupling with the data, which means Hive does not manage the data of the External table. We create an external table for external use as when we want to use the data outside the Hive. When we drop the external table or its partitions , then only the metadata associated with the table will get deleted, the table data remains untouched by Hive.
To convert hive managed table to external table the following command will help without recreating the data.
alter table <TABLE NAME> SET TBLPROPERTIES('EXTERNAL'='TRUE') alter table HRM.FRESHERS_IN_TABLE SET TBLPROPERTIES('EXTERNAL'='TRUE')
A real use case is if you want to recreate a managed table and you don’t want to delete the entire data , then this action can be performed. Once everything is done you can convert it back to managed table by having the value (‘EXTERNAL’=’FALSE’)