阿里云DateWorks的增删改查

表:

1、重命名 alter table <table_name> rename to <new_table_name>;
2、修改表注释 alter table <table_name> set comment '<new_comment>';
3、新增列 alter table <table_name> add columns (customer_name STRING comment '客户', education BIGINT comment '教育' );

4、修改表sale_detail的列名customer_name为customer_newname,注释“客户”为“customer”。
alter table <table_name> change column customer_name  customer_newname STRING comment 'customer';

修改数据 类型
--将mf_evol_t3表的id字段由int转化为bigint
alter table mf_evol_t3 change id id bigint;
--将mf_evol_t3表的id字段类型由bigint转化为string
alter table mf_evol_t3 change column id id string;
修改列名和注释
-
---合并小文件
ALTER TABLE <tablename> [PARTITION(<partition_key>=<partition_value>)] MERGE SMALLFILES;

insert into table charge_order values()---插入数据charge_order

----------------------------转------------------------------
 INSERT into TABLE 202304_roam partition  (dt ) 
 SELECT *

 FROM lvcc_production.202304_roam_back

--------------------------------创---------------------------

insert into table charge_order values()---插入数据charge_order
drop table charge_order----删表
---删分区
--执行如下语句批量删除多级分区,两个匹配条件是或的关系,会将sale_date小于201911或region等于beijing的分区都删除掉。
alter table region_sale_detail drop if exists partition(sale_date < '201911'),partition(region = 'beijing');
--如果删除sale_date小于201911且region等于beijing的分区,可以使用如下方法。
alter table region_sale_detail drop if exists partition(sale_date < '201911', region = 'beijing');
------------------------恢复------------------------
可以通过desc extended table获取
desc extended mf_tts;

------------------------------改------------------------------
alter table charge_order merge if exists
partition(ds='20181101', hh='00', mm='00')
,

  • 5
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值