1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| # 通过查询语句插入数据 # 创建表 create table st( > id int,name string) > partitioned by(month string) > row format delimited fields terminated by '\t'; # 插入基本的数据 insert into table st partition(month='202006')values(3,'zs'),(2,'ww'); # 查询单张表插入 insert overwrite table st partition(month='202007') > select id,name from st; # 查询多张插入 from student > insert overwrite table student partition(month='201707') > select id, name where month='201709' > insert overwrite table student partition(month='201706') > select id, name where month='201709'; # 查询语句中创建表并加入数据 create table st03 > as select id,name from st;
|