1、Create [EXTERNAL] TABLE [IF NOT EXISTS] table_name
external 创建外部表, location为外部表存放位置,Hive 创建内部表时,
会把数据移到数据仓库指向的路径,如果创建了外部表,仅记录数据所在的路径,
不对数据位置做更改。在删除表的时候,内部表的元数据和数 据会被一起删除,而外部表只删除元数据,不删除数据。
[(col_name data_type [COMMENT col_comment], ...)]
[COMMENT table_comment]
[PARTITIONED BY (col_name data_type [COMMENT col_comment], ...)]
[CLUSTERED BY (col_name, col_name, ...) [SORTED BY (col_name [ASC|DESC], ...)] INTO num_buckets BUCKETS]
[ROW FORMAT row_format]
[STORED AS file_format]
[LOCATION hdfs_path]
原文地址:https://www.cnblogs.com/xiaocainiaohuzhuo/p/7456402.html
时间: 2024-10-13 13:39:11