在大数据环境下,hive一款很好用的数据分析的工具,当然它只是用来分析简单的东西。下面是一些常用的东西:
外部表 内部表 分区 存储制定目录 分隔符
内部:load data local inpath '' overwrite into table
' '
外部:create external table if not exists '' row format delimited fields terminated by ',' location 'path',
复制表结构 like mydb.forjson etc;
分区: partitoned by() ,查看:show partitions tablename
自定义表的存储格式:stored as textfile;
通过查询语句向表中插入数据: like:
insert overwrite table employees partiton (couty='us' ,stat='or') select * from staged_employees se where se.cuty='us' se.st='or'
单个查询数据加载:
insert overwrite local directory 'path' select * from emloyees where se .stat='ca'
嵌套select语句:
from(select * from a) e select e.name where