Skip to content

Latest commit

 

History

History
55 lines (34 loc) · 746 Bytes

逻辑运算.md

File metadata and controls

55 lines (34 loc) · 746 Bytes

逻辑运算:

1. 逻辑与操作: AND

语法: A AND B

操作类型:boolean

说明:如果A和B均为TRUE,则为TRUE;否则为FALSE。如果A为NULL或B为NULL,则为NULL
  • 举例:
hive> select 1 from table_name where 1=1 and 2=2;

1

2. 逻辑或操作: OR

语法: A OR B

操作类型:boolean

说明:如果A为TRUE,或者B为TRUE,或者A和B均为TRUE,则为TRUE;否则为FALSE
  • 举例:
hive> select 1 from table_name where 1=2 or 2=2;

1

3. 逻辑非操作: NOT

语法: NOT A

操作类型:boolean

说明:如果A为FALSE,或者A为NULL,则为TRUE;否则为FALSE
  • 举例:
hive> select 1 from table_name where not 1=2;

1