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';

你可能感兴趣的:(hive 建表语句)