Where and group by statements in a HIVE-2.HIVEQL query

Source: Internet
Author: User
1. Where statement

Query the list of English scores greater than or equal to 70:

Select Name,ceil (Salary) as salary,age from employees where score[' 中文版 ']>=70;

Output Result:

Name Salary Age

WANGWU1 5500 20

WANGWU3 8400 20

Wangwu4 8400 20

Use the like statement to blur the view of list information

Select Name,ceil (Salary) as salary,age,address.province from employees where address.province like ' river% ';

Output Result:

Name Salary Age Province

Wangwu3 8400 20 Hebei

Wangwu4 8400 20 Hebei

Queries that contain "state" or "high monument" keywords are queried by the like statement and the Rlike statement, two scenarios:

SELECT * FROM employees where address.street like '% State% ' OR address.street like '% High Monument% '

SELECT * FROM Employees where Address.street rlike '. * (State | High monument). * ';

It is also possible to plan Rlike support Java-like regular expressions through the above scheme, which is the extension of Hive 2. GROUP by Statement

The statement is typically used with aggregate functions, grouped by one or more queued results, and then an aggregate function is executed for each grouping.

After the group by group is completed, the group is then filtered by the having to conditionally filter the results after grouping.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.