create table if not exists dt_part1(
uid int,
uname string,
uage int
)
PARTITIONED BY (year string,month string)
row format delimited
fields terminated by ',';
/*不能用load的方式加载数据*/
load data local inpath '/usr/local/xxx' into table part1
partition(year,month);
/*建立临时表*/
create table if not exists part_tmp(
uid int,
uname string,
uage int,
year string,
month string
)
row format delimited
fields terminated by ',';
insert into dt_part1 partition(year,month)select * from part_tmp;
select PART_NAME FROM PARTITIONS WHERE TBL_ID=(SELECT TBL_ID FROM TBLS WHERE TBL_NAME='dy_part2');insertinto acct_wt_user_avg_stock_hold_days partition(part_init_date='20190425',interval_type=1);select'20190425','4567890',30from acct_wt_user_hold_stock_earnging_ratio limit1;altertable person_partition addifnotexistspartition(year=2015,month=12,day=26);