数据定义语言:(DDL)
建表语句:
CREATE TABLE [IF NOT EXISTS] table_name [(col_name data_type [COMMENT col_comment], ...)] // 设置表的字段,给字段添加注释 [COMMENT table_comment] //给建的表添加注释 [PARTITIONED BY (col_name data_type [COMMENT col_comment], ...)] //添加分区,目前分区标只能是string类型的; [LIFECYCLE days] //设置表的生命周期 [AS select_statement] //也可以用as方式建表,但是as和第一个的col方式是不能并存的
删表:
drop table [if exists] table_name;
修改表名:
alter table table_name rename to new_table_name;
分区操作:
添加分区:
alter table table_name add [if not exists] partition(partition_col1 = partition_col_value1, partition_col2 = partiton_col_value2, ...);
删除分区:
alter table table_name drop [if exists] partition(partition_col1 = partition_col_value1, partition_col2 = partiton_col_value2, ...);
修改属性:
添加列:
others:...