目录
1:展示一个表的分区
show partitions dw_htlbizdb.userlibrary_new
结果:
2: 查看一个job的原代码
其中:d为分区,id为你要查看的job的id
select * from ods_zeus.ods_zeus_job
where d = '2017-09-28'
and id = 16476
结果:job的代码在script中
3:修改一个表中某个字段的描述
alter table a CHANGE COLUMN rpt_tag rpt_tag int comment '1新客,2新转老,3新注册,5老客';
4:删除分区
use datebase;
alter table aa drop partition (d='${Last_Week}');
5:修改表名
use datebase;
ALTER TABLE aa RENAME TO bb
6:添加一列
use datebase;
alter table aa add columns (price_deduc string comment '页面价格');
7:修改列的属性
use datebase;
alter table aa change column ordpersons ordpersons int;
8:添加分区
use datebase;
alter table aa add partition(d=‘2016-10-10’);
9:删除表
use datebase;
drop table aa;
10:根据一个已存在的表,新建一个结构一样的表
use datebase;
CREATE TABLE aa
LIKE bb;