Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the hive relational operations?

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article is to share with you what hive relational computing has. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Relational operation: 1. Equivalent comparison: =

Grammar: axib

Operation types: all basic types

Description: TRUE; if expression An is equal to expression B, otherwise FALSE

For example:

Hive > select 1 from lxw_dual where 1

two。 Unequal value comparison:

Grammar: a B

Operation types: all basic types

Description: if expression An is NULL, or expression B is NULL, return NULL; if expression An and expression B are not equal, TRUE; otherwise FALSE

For example:

Hive > select1 from lxw_dual where 1 2

3. Less than compare: select1 from lxw_dual where 1

< 2; 4. 小于等于比较: B 操作类型: 所有基本类型 描述: 如果表达式A为NULL,或者表达式B为NULL,返回NULL;如果表达式A大于表达式B,则为TRUE;否则为FALSE 举例: hive>

Select1 from lxw_dual where 2 > 1

6. Greater than or equal to comparison: > =

Syntax: a > = B

Operation types: all basic types

Description: if expression An is NULL, or expression B is NULL, return NULL; if expression An is greater than or equal to expression B, TRUE; otherwise FALSE

For example:

Hive > select1 from lxw_dual where 1 > = 1

Note: we should pay attention to the comparison of String (commonly used time comparison can be compared after to_date)

Hive > select* from lxw_dual

OK

201111120900:00:00 2011111209

Hive > selecta,b,ab,a=b from lxw_dual

201111120900:00:00 2011111209 false true false

7. Null value judgment: IS NULL

Syntax: An IS NULL

Operation types: all types

Description: TRUE; if the value of expression An is NULL, otherwise FALSE

For example:

Hive > select1 from lxw_dual where null is null

8. Non-empty judgment: IS NOTNULL

Syntax: An IS NOT NULL

Operation types: all types

Description: FALSE; if the value of expression An is NULL, otherwise TRUE

For example:

Hive > select1 from lxw_dual where 1 is not null

9. LIKE comparison: LIKE

Syntax: A LIKE B

Operation type: strings

Description: returns NULL; if string An or string B is NULL. If string A conforms to the regular syntax of expression B, it is TRUE; otherwise FALSE. The character "_" in B represents any single character, while the character "%" represents any number of characters.

For example:

Hive > select1 from lxw_dual where 'football' like' foot%'

Hive > select1 from lxw_dual where 'football' like' foot____'

Note: use NOT ALIKE B when negative comparison

Hive > select1 from lxw_dual where NOT 'football' like' fff%'

10. LIKE operation of JAVA: RLIKE

Syntax: A RLIKE B

Operation type: strings

Description: returns NULL; if string An or string B is NULL. If string A conforms to the regular syntax of JAVA regular expression B, TRUE; otherwise FALSE.

For example:

Hive > select1 from lxw_dual where 'footbar' rlike' ^ f.roomringing'

Note: determine whether a string is all numeric:

Hive > select 1from lxw_dual where '123456' rlike' ^\\ dbuyer'

Hive > select1 from lxw_dual where '123456aa' rlike'^\\ dbath

11. REGEXP operation: REGEXP

Syntax: A REGEXP B

Operation type: strings

Description: the function is the same as RLIKE

For example:

Hive > select1 from lxw_dual where 'footbar' REGEXP' ^ f.roomringing'

Thank you for reading! This is the end of this article on "what are the hive relational operations?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report