MySQL MONTHNAME() from numbers

Solution 1:

You can use STR_TO_DATE() to convert the number to a date, and then back with MONTHNAME()

SELECT MONTHNAME(STR_TO_DATE(6, '%m'));

+---------------------------------+
| MONTHNAME(STR_TO_DATE(6, '%m')) |
+---------------------------------+
| June                            |
+---------------------------------+

Warning: This could be slow if done over a lot of rows.

Solution 2:

A somewhat ugly way would be SELECT MONTHNAME(CONCAT('2011-',8,'-01'));

Solution 3:

Before reading Michael's great answer I had thought something like this

select elt(3,'January','February','March',....)

but his one is much better. :)