Apache-presto-arithmetic-operator

提供:Dev Guides
移動先:案内検索

Apache Presto-算術演算子

次のサンプルクエリは、算術演算子の例です。

クエリ1

presto:default> select 4 + 5 as addition;

結果

 addition
----------
   9
(1 row)

上記の結果から、クエリのエイリアスとして「as」が使用されます。

クエリ2

presto:default> select 4.5-3.5 as sub;

結果

 sub
-----
 1.0
(1 row)

出力は、2つの値の間の減算です。

クエリ3

presto:default> select 4 % 2 as modulus;

結果

 modulus
---------
   0
(1 row)

出力は、指定された値のモジュラスとして返されます。