Apache Presto - 邏輯運算元



邏輯運算子作用於布林運算元併產生布爾結果。讓我們看幾個例子,瞭解邏輯運算子如何在 Presto 中工作 −

查詢 1

select 3 < 2 and 4 > 1 as logical; 

結果

logical 
--------- 
 false 

此處,4 > 1 為假,因此“AND”運算子將結果返回為假。

查詢 2

presto:default> select 3 < 2 or 4 > 1 as logical;

結果

logical 
--------- 
 true 
(1 row) 

這兩個條件都為真,因此結果為真。

查詢 3

presto:default> select 3 not in (1,2) as not_operator; 

結果

 not_operator 
-------------- 
 true 
(1 row)

此處,值 3 不在給定集合 (1,2) 中,因此它會產生真結果。

apache_presto_basic_sql_operations.htm
廣告
© . All rights reserved.