in the database there is a field of type Date yyyy-mm-dd , in oracle, I got mm using this code

 SELECT nvl(substr(column_name, 4, instr(column_name,'.')-1),column_name) FROM table 

is there such a mysql

2 answers 2

EXTRACT , MONTH functions. sql-tutorial.ru/ru/book/datepart_function/page2.html - getting the month.
IFNULL is an analogue of NVL .

  • It is worth noting that ifnull is a mysql specific function. There is a standard analogue supported by almost all DBMSs (including mysql and oracle): coalesce - Mike

like this: month (column_name)