1、内部表
Hive中預設的表就是内部表,即中繼資料存在資料庫中,資料存在HDFS中
順便補充以下建立内部表的細節:指定列分隔符、從其他表中查詢插入
内部表被删除後,HDFS會把其移動到垃圾箱中
2、分區表
作用:加快查詢效率,如按照性别分區
如果按照性别進行分區,則可以加快按照性别查詢時的查找效率
分區表建立執行個體:
在mysql中建立一個person表,并插入幾條資料
使用Sqoop将mysql數組導入到hive中
在hive中查詢是否導入成功 select * from person
建立分區表并指定列分隔符 create table partitiontable(sid int,sname string) partitioned by (gender string) row format delimited fields terminated by ',';
向分區表的gender=M分區中插入從person中查詢的gender=M的資料:
insert into table partitiontable partition(gender='F') select id,name from person where gender = 'F';
insert into table partitiontable partition(gender='M') select id,name from person where gender = 'M';
在HDFS中檢視分區表的結構和内容
3、外部表
3、桶表
将某個屬性進行hash,分到一定數量的桶中
4、視圖
概念與資料庫中的視圖概念基本相同,了解為虛表