Github user liuyu000 commented on a diff in the pull request: https://github.com/apache/trafodion/pull/1653#discussion_r204964420 --- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc --- @@ -4437,35 +4437,670 @@ interval value expression. It returns an exact numeric value. EXTRACT (datetime-field FROM extract-source) ``` +[[extract_function_syntax]] +=== Syntax Descriptions of EXTRACT Function + * `_datetime-field_` is: + -YEAR \| MONTH \| DAY \| HOUR \| MINUTE \| SECOND +.Details of `_datetime-field_` +[cols="20%,40%,40%"] +|=== +^| `_datetime-filed_` +^| *Description* +^| *Supported* `_extract-source_` + +a| CENTURY +| Century. +a| * `_datetime-expression_` +** DATE +** TIMESTAMP + +| DAY +a| * `_datetime-expression_` + +Day. +* `_interval-expression_` + +Number of day(s) in the `_interval-expression_`. + +a| * `_datetime-expression_` +** DATE +** TIMESTAMP + +| DECADE +a| * `_datetime-expression_` + +Year field divided by 10. +* `_interval-expression_` + +Number of decade(s) in the `_interval-expression_`. + +a| * `_datetime-expression_` +** DATE +** TIMESTAMP +* `_interval-expression_` + +| DOW +| Day of week (1-7), where 1 is Sunday, 6 is Saturday. + +This is not configurable. +a| * `_datetime-expression_` +** DATE +** TIMESTAMP +| DOY +| Day of year (1-366). +a| * `_datetime-expression_` +** DATE +** TIMESTAMP + +| EPOCH +a| * `_datetime-expression_` + +Second(s) since 1970-01-01 00:00:00. + +The value is negative if `_datetime-expression_` precedes 1970-01-01 00:00:00. +* `_interval-expression_` + +Number of second(s) in the `_interval-expression_`. + +a| * `_datetime-expression_` +** DATE +** TIMESTAMP +* `_interval-expression_` + +| HOUR +a| * `_datetime-expression_` + +Hour (0-23). +* `_interval-expression_` + +Number of hour(s) in the `_interval-expression_`. + +a| * `_datetime-expression_` + +** TIME +** TIMESTAMP +* `_interval-expression_` + +| MINUTE +a| * `_datetime-expression_` + +Minute (0-59). +* `_interval-expression_` + +Number of minute(s) in the `_interval-expression_`. + +a| * `_datetime-expression_` +** TIME +** TIMESTAMP +* `_interval-expression_` + +| MONTH +a| * `_datetime-expression_` + +Month (1-12). +* `_interval-expression_` + +Number of month(s) in the `_interval-expression_`. + +a| * `_datetime-expression_` +** DATE +** TIMESTAMP +* `_interval-expression_` + +| QUARTER +a| * `_datetime-expression_` + +Quarter of year (1-4). +* `_interval-expression_` + +Number of quarter(s) in the `_interval-expression_`. +a| * `_datetime-expression_` +** DATE +** TIMESTAMP +* `_interval-expression_` + +| SECOND +a| * `_datetime-expression_` + +Second (0-59). +* `_interval-expression_` + +Number of second(s) in the `_interval-expression_`. + +a| * `_datetime-expression_` + +** TIME +** TIMESTAMP +* `_interval-expression_` + + +| WEEK +a| * `_datetime-expression_` + +a| Week of year. + + +* The value 1 is returned for datetime that occurs in the first 7 days of the year if the year begins on Sunday. + --- End diff -- Thanks Dave, I've corrected all ð
---