数据仓库服务 GAUSSDB(DWS)-INTERVAL

时间:2024-11-15 15:20:02

INTERVAL

MySQL中使用interval表达式格式为INTERVAL N时间单位,DWS不支持,需要转换为INTERVAL 'N'时间单位。

输入示例

1
2
3
4
5
6
SELECT CURRENT_TIME() - INTERVAL 4 DAY;
SELECT NOW() - INTERVAL 5 HOUR;
SELECT CURRENT_TIME() - INTERVAL '4' DAY;
SELECT NOW() - INTERVAL '5' HOUR;
SELECT CURRENT_TIME() - INTERVAL "4" DAY;
SELECT NOW() - INTERVAL "5" HOUR;

输出示例

1
2
3
4
5
6
SELECT  (CURRENT_TIME () - INTERVAL '4' DAY);
SELECT  (NOW () - INTERVAL '5' HOUR);
SELECT  (CURRENT_TIME () - INTERVAL '4' DAY);
SELECT  (NOW () - INTERVAL '5' HOUR);
SELECT  (CURRENT_TIME () - INTERVAL '4' DAY);
SELECT  (NOW () - INTERVAL '5' HOUR);
support.huaweicloud.com/tg-dws/dws_16_0180.html