您的位置:首页 > 其它

hive建表语句(不同的数据存储格式,包括txt、orc、分区)

2017-12-12 10:47 495 查看
use sx_360_safe;

create table sx_360_safe.sx_ela_bp_info

(

id_ela_bp_info   string  

,code            string

,agent_no        string

,operation_time  string 

,product_no      string

,info_no         string

,created_by      string

,created_date    string

,updated_by      string

,updated_date    string

,openid          string

,page            string

)

row format delimited fields terminated by '\t' lines terminated by '\n' stored as textfile;

----delimited fields terminated by '\t'  通过'\t'分割字段
----lines terminated by '\n'            通过'\n'结束一行字段

------------------------------------------------------------------

分隔符

------------------------------------------------------------------

use sx_360_safe;

 create table sx_360_safe.agg_lbk_toapp_bussiness_app_wide

(

calc_date    string                  , 

branch0_code    string              ,

branch0_name    string              ,

branch1_code    string              ,

branch1_name    string              ,

branch2_code    string              ,

branch2_name    string              ,

branch3_code    string              ,

branch3_name    string              ,

title    string                      ,

measures_code    string              ,

measures_name    string              ,

sum_data_day    decimal(38,10)      ,

sum_data_month    decimal(38,10)      ,

sum_data_year    decimal(38,10)      ,

data_lastyear_d    decimal(38,10)      ,

data_lastyear_m    decimal(38,10)      ,

data_lastyear_y    decimal(38,10)      ,

day_inc    decimal(38,10)              ,

month_inc    decimal(38,10)          ,

year_inc    decimal(38,10)          ,

month_comple_deno    decimal(38,10),    

year_comple_deno    decimal(38,10),    

month_comple    decimal(38,10)      ,

year_comple    decimal(38,10)          ,

data_day_sor    string              ,

data_month_sor    string              ,

data_year_sor    string              ,

day_inc_sor    string                  ,

month_inc_sor    string              ,

year_inc_sor    string              ,

month_comple_sor    string          ,

year_comple_sor    string              ,

system_order_fm    string    

)

partitioned by (day  string)

row format delimited fields terminated by '\001' stored as TEXTFILE ;

------------------------------------------------------------------

分隔符

------------------------------------------------------------------

use sx_360_safe;

 create table sx_360_safe.dim_olp_bank_table_grade_l

(

branch_grade    decimal(38,0)  ,

branch0_code    string         ,

branch0_name    string         ,

branch1_code    string         ,

branch1_name    string         ,

branch2_code    string         ,

branch2_name    string         ,

branch3_code    string         ,

branch3_name    string         ,

branch4_code    string         ,

branch4_name    string         ,

branch5_code    string         ,

branch5_name    string         ,

branch6_code    string         ,

branch6_name    string       

)

stored as orcfile;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐