I have a table called staff_leave, and I want to split date range to days per row. is it possible. I am a newbie please take it easy .
like: there is a date range 01/01/2013 - 05/01/2013
and i want to split it to 5 days and store each day in each single row of another table.
CREATE TABLE IF NOT EXISTS `staff_leave` (
`id_staff_leave` int(11) NOT NULL AUTO_INCREMENT,
`staff_id_staff` int(11) NOT NULL,
`leave_type_id_leave_type` int(11) NOT NULL,
`start_date` date NOT NULL,
`end_date` date NOT NULL,
`joining_date` date NOT NULL,
`is_half_day` date DEFAULT NULL,
`approved` int(11) DEFAULT NULL,
`approved_date` date DEFAULT NULL,
PRIMARY KEY (`id_staff_leave`),
UNIQUE KEY `id_staff_leave_UNIQUE` (`id_staff_leave`),
KEY `fk_staff_leave_staff1` (`staff_id_staff`),
KEY `fk_staff_leave_leave_type1` (`leave_type_id_leave_type`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

date range 01/01/2013 - 05/01/2013. Since you mentioned 5 days, is that date formatdd/mm/yyyy? – RolandoMySQLDBA Jan 16 at 17:30id_staff_leave_UNIQUEkey is redundant since it's exactly the same as thePRIMARY KEY– Shlomi Noach Jan 17 at 8:58