hive 建表语句

## 建表语句
create external table employee (
    eid int,
    ename string
)
partitioned by (gender string)
row format delimited fields terminated by ','
location '/usr/hive/employee';

create table bucket_table (
    sid int,
    sname string,
    age int
)
clustered by (sname) into 5 buckets;

## 查看表信息
desc employee;

## 插入数据
insert into table employee partitioned by (gender='M') 
select sid,sname,gender
from sample_data where gender='M';

## sql执行的优化
explain select * from employee where gender='M';
    原文作者:darebeat
    原文地址: https://www.jianshu.com/p/b9ed7068ddee
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞