Apache Presto - 日期時間運算子



查詢 1

presto:default> select date '2016-06-20' + interval '2' day as date_add; 

結果

 date_add 
------------ 
 2016-06-22 

上述輸出表示使用間隔資料型別從指定日期新增兩天。

查詢 2

presto:default> select time '12:30' + interval '1' hour as time_add; 

結果

   time_add 
-------------- 
 13:30:00.000 

此處,從給定時間新增一小時。

查詢 3

presto:default> select timestamp '2016-06-21 12:32' + interval '2' year 
as timestamp_add;

結果

   timestamp_add 
------------------------- 
 2018-06-21 12:32:00.000 
apache_presto_basic_sql_operations.htm
廣告
© . All rights reserved.