Hive 資料型別和建表語法

2021-10-10 23:07:40 字數 993 閱讀 1093

tinyint            1byte有符號整數    20

smallint         2byte有符號整數    20

int    **              有符號整數    20

bigint**            8byte有符號整數    20

boolean          布林型別,true或者false    true  false

float                單精度浮點數    3.14159

double    **      雙精度浮點數    3.14159

string    **       字元系列。可以指定字符集。可以使用單引號或者雙引號。    『now is the time』 「for all good men」

timestamp    **

binary    

create [external] table [if not exists] 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] 

[row format row_format]   row format delimited fields terminated by 「分隔符」

[stored as file_format]

[location hdfs_path]

hive建表語法和引數說明

create external table if not exists table name col name data type comment 字段描述資訊 col name data type comment 字段描述資訊 comment 表的描述資訊 partitioned by col n...

Hive建表語法 內部表 外部表

寫語句時未被external修飾的表是內部表特點 當刪除該錶時,表的元資料也會跟著被刪除,會影響其他使用該資料的表 從以上的操作可以看出兩個表共同使用乙個資訊,如果刪除乙個表的元資料的話,hdfs上的儲存資料也會跟著刪除,導致另外的表的資料也會丟失。不加external會預設為內部表 管理表 對於一...

Hive的資料型別 和建表模型

資料型別為常用 tinyint 1byte有符號整數 20 smallint 2byte有符號整數 20 int 有符號整數 20 bigint8byte有符號整數 20 boolean 布林型別,true或者false true false float 單精度浮點數 3.14159 double ...