hive创建临时表语法
时间: 2023-11-03 12:37:38 浏览: 170
hive元数据生成建表语句
5星 · 资源好评率100%
创建临时表的语法如下:
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] table_name
(column1 data_type [column_constraint], column2 data_type [column_constraint], ...)
[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]
[TBLPROPERTIES (property_name=property_value, ...)];
注意:TEMPORARY关键字用于创建临时表,临时表只在当前会话中存在,会话结束后即被删除。如果不使用TEMPORARY关键字,则创建的是普通表。
阅读全文