Extraction Function Archives - Tech Insights https://reactconf.org/category/extraction-function/ Unveiling Tomorrow's Tech Today, Where Innovation Meets Insight Mon, 04 Feb 2013 17:09:00 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 https://i0.wp.com/reactconf.org/wp-content/uploads/2023/11/cropped-reactconf.png?fit=32%2C32&ssl=1 Extraction Function Archives - Tech Insights https://reactconf.org/category/extraction-function/ 32 32 230003556 EXTRACT Function in SQL https://reactconf.org/extract-function-in-sql-oracle/ https://reactconf.org/extract-function-in-sql-oracle/#respond Mon, 04 Feb 2013 17:09:00 +0000 http://www.sqlneed.com/2013/02/04/extract-function-in-sql/ EXTRACT function  extracts and returns the year, month, day, hour, minute, second, or time zone from Z, Z may be a  timestamp or a DATE. The Syntax of the EXTRACT …

The post EXTRACT Function in SQL appeared first on Tech Insights.

]]>

EXTRACT function  extracts and returns the year, month, day, hour, minute, second, or time zone from Z, Z may be a  timestamp or a DATE.
The Syntax of the EXTRACT Function is:
EXTRACT({ YEAR | MONTH | DAY |HOUR | MINUTE | SECOND } |
{ TIMEZONE_HOUR |TIMEZONE_MINUTE } |{ TIMEZONE_REGION | }
TIMEZONE_ABBR }FROM  Z)
This query returns Day ,Month and Year from the Hire_date field.

SELECT First_Name,Last_Name,EXTRACT(Day from Hire_date) 
as Day,EXTRACT(Month from Hire_date) as Month,
EXTRACT(Year from Hire_date) as Year from employees
Result 


This  query  display the hour, minute, and second from a TIMESTAMP returned by TO_TIMESTAMP():
SELECT
EXTRACT(HOUR FROM TO_TIMESTAMP(’07-May-2011 15:18:27′,’DD-MON-YYYY HH24:MI:SS’)) AS HOUR,
EXTRACT(MINUTE FROM TO_TIMESTAMP(’07-May-2011 15:18:27′,’DD-MON-YYYY HH24:MI:SS’)) AS MINUTE,
EXTRACT(SECOND FROM TO_TIMESTAMP(’07-May-2011 15:18:27′,’DD-MON-YYYY HH24:MI:SS’)) AS SECOND
FROM dual;
 Result :
 

The post EXTRACT Function in SQL appeared first on Tech Insights.

]]>
https://reactconf.org/extract-function-in-sql-oracle/feed/ 0 2230