Help Center/
GaussDB(DWS)/
Tool Guide/
DSC/
SQL Syntax Migration Reference/
MySQL Syntax Migrating/
Data Manipulation Language (DML)/
SELECT/
INTERVAL
Updated on 2024-07-19 GMT+08:00
INTERVAL
In MySQL, the interval expression format is INTERVAL N, which is not supported by GaussDB(DWS) and needs to be converted to INTERVAL'N'.
Input
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; |
Output
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); |
Parent topic: SELECT
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot