extract year and month from date in sql code example
Example 1: mysql extract month
SELECT EXTRACT(MONTH FROM '2020-07-05')
Example 2: extract year from date sql
SELECT extract(YEAR FROM sysdate) FROM dual; // number
SELECT to_char(sysdate, 'YYYY') FROM dual; // varchar