文章目錄
- Hive資料倉庫——DDL、DQL概述
- Hive--HQL語法--DDL
- Hive--HQL語法--DML
- Hive HQL圖解
Hive資料倉庫——DDL、DQL概述
Hive–HQL語法–DDL
- 創建資料庫 create database XXXXX;
- 查看資料庫 show databases;
- 洗掉資料庫 drop database tmp;
- 強制洗掉資料庫:drop database tmp cascade;
- 查看表:SHOW TABLES;
- 查看表的元資訊:
- desc test_table;
- describe extended test_table;
- describe formatted test_table;
- 查看建表陳述句:show create table table_XXX;
- 重命名表:alter table test_table rename to new_table;
- 修改列資料型別:alter table lv_test change column colxx string;
- 增加、洗掉磁區:
- alter table test_table add partition (pt=xxxx);
- alter table test_table drop if exists partition(…);
Hive–HQL語法–DML
- where用于過濾,磁區裁剪,指定條件
- join用于兩表關聯,left out join,left join,right join,join,mapjoin(1.2版本后默認開啟)
- group by用于分組聚合
- order by用于全域排序,要盡量避免排序,是針對全域排序的,即對所有的reduce輸出是有序的
- sort by sortby:當有多個reduce時,只能保證單個reduce輸出有序,不能保證全域有序
cluster by = distribute by + sort by - distinct 去重
Hive HQL圖解
靚仔不久會詳細介紹Hive的初級函式以及高級函式,快來關注一下吧!
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/430281.html
標籤:其他
