Zkplo opened a new issue, #11081:
URL: https://github.com/apache/inlong/issues/11081

   ### Description
   
   - parent issue #10796 
   - MySql Official Description: 
https://dev.mysql.com/doc/refman/8.4/en/expressions.html#temporal-intervals
   
   interval_expr in expressions represents a temporal interval. Intervals have 
this syntax:
   ```sql
   INTERVAL expr unit
   ```
   expr represents a quantity. unit represents the unit for interpreting the 
quantity; it is a specifier such as HOUR, DAY, or WEEK. The INTERVAL keyword 
and the unit specifier are not case-sensitive.The following table shows the 
expected form of the expr argument for each unit value.
   
   | *`unit`* Value       | Expected *`expr`* Format                    |
   | :------------------- | :------------------------------------------ |
   | `MICROSECOND`        | `MICROSECONDS`                              |
   | `SECOND`             | `SECONDS`                                   |
   | `MINUTE`             | `MINUTES`                                   |
   | `HOUR`               | `HOURS`                                     |
   | `DAY`                | `DAYS`                                      |
   | `WEEK`               | `WEEKS`                                     |
   | `MONTH`              | `MONTHS`                                    |
   | `QUARTER`            | `QUARTERS`                                  |
   | `YEAR`               | `YEARS`                                     |
   | `SECOND_MICROSECOND` | `'SECONDS.MICROSECONDS'`                    |
   | `MINUTE_MICROSECOND` | `'MINUTES:SECONDS.MICROSECONDS'`            |
   | `MINUTE_SECOND`      | `'MINUTES:SECONDS'`                         |
   | `HOUR_MICROSECOND`   | `'HOURS:MINUTES:SECONDS.MICROSECONDS'`      |
   | `HOUR_SECOND`        | `'HOURS:MINUTES:SECONDS'`                   |
   | `HOUR_MINUTE`        | `'HOURS:MINUTES'`                           |
   | `DAY_MICROSECOND`    | `'DAYS HOURS:MINUTES:SECONDS.MICROSECONDS'` |
   | `DAY_SECOND`         | `'DAYS HOURS:MINUTES:SECONDS'`              |
   | `DAY_MINUTE`         | `'DAYS HOURS:MINUTES'`                      |
   | `DAY_HOUR`           | `'DAYS HOURS'`                              |
   | `YEAR_MONTH`         | `'YEARS-MONTHS'`                            |
   
   ### Use case
   
   ```
   DATE_ADD('2018-05-01',INTERVAL 1 DAY)                                        
    -> '2018-05-02'
   DATE_SUB('2018-05-01',INTERVAL 1 YEAR)                                       
    -> '2017-05-01'
   DATE_ADD('2020-12-31 23:59:59',  INTERVAL 1 SECOND);                         
    ->  '2021-01-01 00:00:00'
   DATE_ADD('2018-12-31 23:59:59', INTERVAL 1 DAY);                             
    -> '2019-01-01 23:59:59'
   DATE_ADD('2100-12-31 23:59:59', INTERVAL '1:1' MINUTE_SECOND);               
    -> '2101-01-01 00:01:00'
   DATE_SUB('2025-01-01 00:00:00', INTERVAL '1 1:1:1' DAY_SECOND);              
    -> '2024-12-30 22:58:59'
   DATE_ADD('1900-01-01 00:00:00', INTERVAL '-1 10' DAY_HOUR);                  
    -> '1899-12-30 14:00:00'
   DATE_SUB('1998-01-02', INTERVAL 31 DAY);                                     
    -> '1997-12-02'
   DATE_ADD('1992-12-31 23:59:59.000002', INTERVAL '1.999999' 
SECOND_MICROSECOND);  -> '1993-01-01 00:00:01.000001'
   
   
   '2018-12-31 23:59:59' + INTERVAL 1 SECOND;                                   
    -> '2019-01-01 00:00:00'
   INTERVAL 1 DAY + '2018-12-31';                                               
    -> '2019-01-01'
   '2025-01-01' - INTERVAL 1 SECOND;                                            
    -> '2024-12-31 23:59:59'
   ```
   
   ### Are you willing to submit PR?
   
   - [X] Yes, I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@inlong.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to