3-1 hive环境搭建
地址:Apache Hive TM
启动:hive
3-2 hive-helloworld
查看所有数据库:
- show databases;
进入default数据库:
- use default;
查看数据库中所有表:
- show tables;
查看表结构:
- desc table_name;
删除表:
- drop table db_name.table_name;
创建表:
- create table db_name.table_name(id bigint, name string);
插入数据:
- insert overwrite table db1.table1 select 100.’hellpworld’ from db2.table2;
查询表:
- select * from db1.table1;
3-3 show 用法
显示所有表:
- show tables;
- show tables like ‘*order*’;
- show tables like ‘…_order’;
显示所有分区:
- show partitions;
- show partitions table_name PARTITION(dt=‘2018-12-01’);
- show partitions table_name PARTITION(dt=‘2018-12-01’,hour=01);
显示表的扩展信息:
- show table extended;
- show table extended like table_name;
显示所有表的属性:
- show table properties;
- show tblproperties table_name(‘e