- Big Data Analytics with Hadoop 3
- Sridhar Alla
- 160字
- 2021-06-25 21:26:11
SELECT statement syntax
Here's the syntax of Hive's SELECT statement:
SELECT [ALL | DISTINCT] select_expr, select_expr, ... FROM table_reference [WHERE where_condition] [GROUP BY col_list] [HAVING having_condition] [CLUSTER BY col_list | [DISTRIBUTE BY col_list] [SORT BY col_list]] [LIMIT number] ;
SELECT is the projection operator in HiveQL. The points are:
- SELECT scans the table specified by the FROM clause
- WHERE gives the condition of what to filter
- GROUP BY gives a list of columns that specifies how to aggregate the records
- CLUSTER BY, DISTRIBUTE BY, and SORT BY specify the sort order and algorithm
- LIMIT specifies how many records to retrieve:
Select Description, count(*) as c from OnlineRetail group By Description order by c DESC limit 5;
The following is the hive console showing the query execution:

select * from OnlineRetail limit 5;
The following is the hive console showing the query execution:

select lower(description), quantity from OnlineRetail limit 5;
The following is the hive console showing the query execution:

推薦閱讀
- Mastering Proxmox(Third Edition)
- 控制與決策系統(tǒng)仿真
- Mobile DevOps
- 2018西門子工業(yè)專家會議論文集(上)
- VMware Performance and Capacity Management(Second Edition)
- 80x86/Pentium微型計算機原理及應用
- 塊數(shù)據(jù)5.0:數(shù)據(jù)社會學的理論與方法
- 變頻器、軟啟動器及PLC實用技術260問
- Enterprise PowerShell Scripting Bootcamp
- 網(wǎng)絡布線與小型局域網(wǎng)搭建
- 單片機原理實用教程
- HBase Essentials
- Apache Spark Quick Start Guide
- PostgreSQL 10 High Performance
- 計算機辦公應用培訓教程