By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table months as
select 1 as id, 'January' as month union all
select 2 as id, 'February' as month
Records: 2 Duplicates: 0 Warnings: 0
select m.*,
date(concat(year(curdate()), '-01-01')) + interval (id - 1) month as month_start,
last_day(date(concat(year(curdate()), '-01-01')) + interval (id - 1) month) as month_end
from months m;
id | month | month_start | month_end |
---|---|---|---|
1 | January | 2024-01-01 | 2024-01-31 |
2 | February | 2024-02-01 | 2024-02-29 |