hive建表語句(不同的資料儲存格式,包括txt、orc、分割槽)
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;