官术网_书友最值得收藏!

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:

主站蜘蛛池模板: 沅江市| 常宁市| 平武县| 肥乡县| 洛扎县| 如皋市| 讷河市| 晋城| 吉安市| 广宗县| 老河口市| 奉新县| 宜章县| 科技| 普兰店市| 扎兰屯市| 祁连县| 盐池县| 泾源县| 铜陵市| 华宁县| 武陟县| 长宁县| 筠连县| 大田县| 修水县| 峨边| 铜川市| 宾阳县| 咸宁市| 吴江市| 广河县| 晋宁县| 张家口市| 英超| 龙口市| 视频| 南靖县| 密山市| 黄山市| 嘉善县|