get year of date sql code example
Example 1: current year sql
-- Oracle
SELECT extract(YEAR FROM sysdate) FROM dual; // number
SELECT to_char(sysdate, 'YYYY') FROM dual; // varchar
Example 2: print year of a date sql
SELECT EXTRACT(YEAR FROM CURRENT_DATE)
Example 3: sql get year from datetime field
SELECT YEAR(DateTimeField)
FROM MyTable