大数据高级ACP学习笔记(3)
DDL语句
CREATE TABLE students (
id BIGINT,
name STRING,
age INT
);
添加一个新的列 grade
(字符串类型)
ALTER TABLE students ADD COLUMN grade STRING;
删除这个表
DROP TABLE students;
对 students
表按照入学年份 enrollment_year
进行分区
CREATE TABLE students (
id BIGINT,
name STRING,
age INT
)
PARTITIONED BY (enrollment_year INT);
添加分区
ALTER TABLE students ADD PARTITION (enrollment_year = 2022);
删除入学年份为 2021 的分区
ALTER TABLE students DROP PARTITION (enrollment_year = 2021);
合并分区列
alter table - merge partition(gender='loss'),partition(gender='male') overwrite partition(gender='unknown') purge;
创建视图
create view v_table_p as
select * from
t_tunnel_p_new;