- 先查看表的类型
hive> desc formatted student;
Table Type: MANAGED_TABLE
hive> desc formatted teacher;
Table Type: EXTERNAL_TABLE
2.修改内部表student为外部表
hive> alter table student set tblproperties(‘EXTERNAL’=‘TRUE’);
hive> desc formatted student;
Table Type: EXTERNAL_TABLE
3.修改外部表teacher为内部表
hive> alter table teacher set tblproperties(‘EXTERNAL’=‘FALSE’);
hive> desc formatted teacher;
Table Type: MANAGED_TABLE
注意:(‘EXTERNAL’=‘TRUE’)和(‘EXTERNAL’=‘FALSE’)为固定写法,区分大小写!