--
-- Structure for view `v_individual_schedule`
--

DROP VIEW IF EXISTS `v_individual_schedule`;
CREATE VIEW `v_individual_schedule`  AS SELECT `v_schedule`.`dt` AS `Date`, dayname(`v_schedule`.`dt`) AS `Day`, concat(`v_schedule`.`fname`,' ',`v_schedule`.`lname`) AS `Name`, `v_schedule`.`interval` AS `Time`, `v_schedule`.`location_name` AS `Location`, `v_schedule`.`ringer` AS `ringer` FROM `v_schedule` WHERE `v_schedule`.`dt` >= curdate() ORDER BY `v_schedule`.`dt` ASC, `v_schedule`.`interval` ASC ;

-- --------------------------------------------------------

--
-- Structure for view `v_schedule`
--

DROP VIEW IF EXISTS `v_schedule`;
CREATE VIEW `v_schedule`  AS SELECT `s`.`dt` AS `dt`, `s`.`slot` AS `slot`, `s`.`ringer` AS `ringer`, `s`.`location` AS `location`, `r`.`fname` AS `fname`, `r`.`lname` AS `lname`, `r`.`email` AS `email`, `r`.`password` AS `password`, `t`.`time` AS `interval`, `L`.`location_name` AS `location_name` FROM (((`schedule` `s` left join `ringers` `r` on(`s`.`ringer` = `r`.`id`)) left join `timeslots` `t` on(`s`.`slot` = `t`.`id`)) left join `locations` `L` on(`s`.`location` = `L`.`id`)) ;

-- --------------------------------------------------------

--
-- Structure for view `v_schedule_with_phone`
--

DROP VIEW IF EXISTS `v_schedule_with_phone`;
CREATE VIEW `v_schedule_with_phone`  AS SELECT `s`.`dt` AS `dt`, `s`.`slot` AS `slot`, `s`.`ringer` AS `ringer`, `s`.`location` AS `location`, `r`.`fname` AS `fname`, `r`.`lname` AS `lname`, `r`.`email` AS `email`, `r`.`password` AS `password`, `r`.`phone` AS `phone`, `t`.`time` AS `interval`, `L`.`location_name` AS `location_name` FROM (((`schedule` `s` left join `ringers` `r` on(`s`.`ringer` = `r`.`id`)) left join `timeslots` `t` on(`s`.`slot` = `t`.`id`)) left join `locations` `L` on(`s`.`location` = `L`.`id`)) ;

-- --------------------------------------------------------

--
-- Structure for view `v_schedule_with_phone_administrator`
--

DROP VIEW IF EXISTS `v_schedule_with_phone_administrator`;
CREATE VIEW `v_schedule_with_phone_administrator`  AS SELECT `s`.`dt` AS `dt`, `s`.`slot` AS `slot`, `s`.`ringer` AS `ringer`, `s`.`location` AS `location`, `r`.`fname` AS `fname`, `r`.`lname` AS `lname`, `r`.`email` AS `email`, `r`.`password` AS `password`, `r`.`phone` AS `phone`, `r`.`administrator` AS `administrator`, `t`.`time` AS `interval`, `L`.`location_name` AS `location_name` FROM (((`schedule` `s` left join `ringers` `r` on(`s`.`ringer` = `r`.`id`)) left join `timeslots` `t` on(`s`.`slot` = `t`.`id`)) left join `locations` `L` on(`s`.`location` = `L`.`id`)) ;
COMMIT;

