Date Extraction Function Extract

Source: Internet
Author: User


EXTRACT extracts and returns the value of a specified datetime field from a datetime or interval expression.

EXTRACT ({Year
| MONTH
| Day
| HOUR
| MINUTE
| SECOND
| Timezone_hour
| Timezone_minute
| Timezone_region
| Timezone_abbr
}
from {expr}
)

Sql> SELECT e.ename,extract (year from E.hiredate) E_year,extract (MONTH from E.hiredate) e_month from EMP E;
Ename e_year E_month
---------- ---------- ----------
SMITH 1980 12
ALLEN 1981 2
WARD 1981 2
JONES 1981 4
MARTIN 1981 9
BLAKE 1981 5
CLARK 1981 6
SCOTT 1987 4
KING 1981 11
TURNER 1981 9
ADAMS 1987 5
JAMES 1981 12
FORD 1981 12
MILLER 1982 1

Date Extraction Function Extract

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.