Hive建表高阶语句、Hive视图
Hive建表高阶语句 - CTAS and WITH
- CTAS – as select方式建表
create table ctas_employee as select * from employee;
注:CTAS不能创建partition, external, bucket table
- CTE (CTAS with Common Table Expression)
create table jobs_details as
with
tmp as (select jobs from employee_partition where info.gender='Male'),
t2 as (select jobs from employee_partition where info.gender='Female')
select tmp.jobs male_job,t2.jobs female_job from tmp,t2;
- Like
create table employee_like like employee;
创建临时表
临时表是应用程序自动管理在复杂查询期间生成的中间数据的方法