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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…