hive 建表语句

2016-09-22  本文已影响1520人  darebeat

## 建表语句
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';
上一篇 下一篇

猜你喜欢

热点阅读