how to extract a year from a date in sql code example
Example 1: print year of a date sql
SELECT EXTRACT(YEAR FROM CURRENT_DATE)
Example 2: sql convert datetime to year
select YEAR(getdate())
/* 2020 */
SELECT EXTRACT(YEAR FROM CURRENT_DATE)
select YEAR(getdate())
/* 2020 */