hive建表语句

更新时间:2023-05-23 15:43:24 阅读: 评论:0

hive建表语句
龙荔1 建表语句结构
CREATE [TEMPORARY] [EXTERNAL] TABLE [IF NOT EXISTS] [db_name.]table_name
[(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
]
[SKEWED BY (col_name, col_name, ...)
ON ((col_value, col_value, ...), (col_value, col_value, ...), ...)
[STORED AS DIRECTORIES]
抽字组词
[
[ROW FORMAT row_format]
[STORED AS file_format]
| STORED BY 'storage.handler.class.name' [WITH SERDEPROPERTIES (...)]
]
[LOCATION hdfs_path]
[TBLPROPERTIES (property_name=property_value, ...)]
[AS lect_statement];
2 复制建表语句世界十大名钢琴
CREATE [TEMPORARY] [EXTERNAL] TABLE [IF NOT EXISTS] [db_name.]table_name
LIKE existing_table_or_view_name
[LOCATION hdfs_path];
3 建表语句说明
data_type
: primitive_type
| array_type
| map_type京东网购
| struct_type
| union_type  -- (Note: Available in Hive 0.7.0 and later)数学基础知识
primitive_type
: TINYINT
| SMALLINT
| INT
| BIGINT
| BOOLEAN
| FLOAT
| DOUBLE
| STRING
| BINARY      -- (Note: Available in Hive 0.8.0 and later)
| TIMESTAMP  -- (Note: Available in Hive 0.8.0 and later)
| DECIMAL    -- (Note: Available in Hive 0.11.0 and later)
| DECIMAL(precision, scale)  -- (Note: Available in Hive 0.13.0 and later)
红楼梦读后感1000字| DATE        -- (Note: Available in Hive 0.12.0 and later)
| VARCHAR    -- (Note: Available in Hive 0.12.0 and later)
| CHAR        -- (Note: Available in Hive 0.13.0 and later)
array_type
: ARRAY < data_type >
map_type
: MAP < primitive_type, data_type >
struct_type
: STRUCT < col_name : data_type [COMMENT col_comment], ...>
union_type
: UNIONTYPE < data_type, data_type, ... >  -- (Note: Available in Hive 0.7.0 and later)
row_format
: DELIMITED [FIELDS TERMINATED BY char [ESCAPED BY char]] [COLLECTION ITEMS TERMINATED BY char]
[MAP KEYS TERMINATED BY char] [LINES TERMINATED BY char]
[NULL DEFINED AS char]  -- (Note: Available in Hive 0.13 and later)
| SERDE rde_name [WITH SERDEPROPERTIES (property_name=property_value, property_name=property_value, ...)] file_format:
: SEQUENCEFILE
| TEXTFILE    -- (Default, depending on hive.default.fileformat configuration)
| RCFILE      -- (Note: Available in Hive 0.6.0 and later)
| ORC        -- (Note: Available in Hive 0.11.0 and later)
| PARQUET    -- (Note: Available in Hive 0.13.0 and later)
| AVRO        -- (Note: Available in Hive 0.14.0 and later)
| INPUTFORMAT input_format_classname OUTPUTFORMAT output_format_classname
'field.delim'='\t'字段之间的分隔符
'line.delim'='\n'⾏之间的分隔符
'rialization.null.format'=''默认null表⽰⽅式(hive默认的情况下会使⽤’/N’来表⽰null值)
可以使⽤ESCAPED BY⼦句(如ESCAPED BY ‘\’)启⽤分隔符的转义,如果数据包含分隔符启⽤转义是必需的// 查看建表语句
人死不能复生>屏幕时间show create table tb_name;
// 查看表结构
desc formatted tb3;

本文发布于:2023-05-23 15:43:24,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/746906.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:语句   建表   转义   包含   分隔符   时间   默认   钢琴
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图