-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `djocas_schedule`
--

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

--
-- Table structure for table `classtypes`
--

CREATE TABLE `classtypes` (
  `type_id` int(11) NOT NULL,
  `type` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `classtypes`
--

INSERT INTO `classtypes` (`type_id`, `type`) VALUES
(1, 'lecture'),
(2, 'lecture'),
(3, 'lecture'),
(4, 'lecture'),
(5, 'lecture'),
(6, 'lecture'),
(7, 'lecture'),
(8, 'lecture'),
(9, 'lecture'),
(10, 'discussion'),
(11, 'lecture'),
(12, 'lecture'),
(13, 'lecture'),
(14, 'lecture'),
(15, 'lecture'),
(16, 'lecture'),
(17, 'lecture'),
(18, 'lecture'),
(19, 'lecture'),
(20, 'discussion'),
(21, 'lecture'),
(22, 'lecture'),
(23, 'lecture'),
(24, 'lecture'),
(25, 'lecture'),
(26, 'lecture'),
(27, 'lecture'),
(28, 'lecture'),
(29, 'lecture'),
(30, 'discussion'),
(31, 'lecture'),
(32, 'lecture'),
(33, 'lecture'),
(34, 'lecture'),
(35, 'lecture'),
(36, 'lecture'),
(37, 'lecture'),
(38, 'lecture'),
(39, 'lecture'),
(40, 'discussion');

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

--
-- Table structure for table `coursenames`
--

CREATE TABLE `coursenames` (
  `coursename_id` int(11) NOT NULL,
  `coursename` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `coursenames`
--

INSERT INTO `coursenames` (`coursename_id`, `coursename`) VALUES
(1, 'ACAD_324'),
(2, 'SPAN_290'),
(3, 'ACAD_276'),
(4, 'ACAD_240'),
(5, 'ACAD_324'),
(6, 'SPAN_290'),
(7, 'ACAD_187'),
(8, 'ACAD_276'),
(9, 'ACAD_240'),
(10, 'SPAN_290'),
(11, 'ACAD_324'),
(12, 'SPAN_290'),
(13, 'ACAD_276'),
(14, 'ACAD_240'),
(15, 'ACAD_324'),
(16, 'SPAN_290'),
(17, 'ACAD_187'),
(18, 'ACAD_276'),
(19, 'ACAD_240'),
(20, 'SPAN_290'),
(21, 'ACAD_324'),
(22, 'SPAN_290'),
(23, 'ACAD_276'),
(24, 'ACAD_240'),
(25, 'ACAD_324'),
(26, 'SPAN_290'),
(27, 'ACAD_187'),
(28, 'ACAD_276'),
(29, 'ACAD_240'),
(30, 'SPAN_290'),
(31, 'ACAD_324'),
(32, 'SPAN_290'),
(33, 'ACAD_276'),
(34, 'ACAD_240'),
(35, 'ACAD_324'),
(36, 'SPAN_290'),
(37, 'ACAD_187'),
(38, 'ACAD_276'),
(39, 'ACAD_240'),
(40, 'SPAN_290');

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

--
-- Table structure for table `mainschedule`
--

CREATE TABLE `mainschedule` (
  `mainschedule_id` int(11) NOT NULL,
  `coursename_id` int(11) NOT NULL,
  `type_id` int(11) NOT NULL,
  `roomnumber_id` int(11) NOT NULL,
  `endtime` time NOT NULL,
  `starttime` time NOT NULL,
  `date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `mainschedule`
--

INSERT INTO `mainschedule` (`mainschedule_id`, `coursename_id`, `type_id`, `roomnumber_id`, `endtime`, `starttime`, `date`) VALUES
(1, 1, 1, 1, '11:50:00', '09:00:00', '2023-09-11'),
(2, 2, 2, 2, '13:50:00', '12:00:00', '2023-09-11'),
(3, 3, 3, 3, '16:50:00', '14:00:00', '2023-09-12'),
(4, 4, 4, 4, '19:50:00', '18:00:00', '2023-09-12'),
(5, 5, 5, 5, '11:50:00', '09:00:00', '2023-09-13'),
(6, 6, 6, 6, '13:50:00', '12:00:00', '2023-09-13'),
(7, 7, 7, 7, '11:50:00', '09:00:00', '2023-09-14'),
(8, 8, 8, 8, '16:50:00', '14:00:00', '2023-09-14'),
(9, 9, 9, 9, '19:50:00', '18:00:00', '2023-09-14'),
(10, 10, 10, 10, '11:50:00', '11:00:00', '2023-09-15'),
(11, 11, 11, 11, '11:50:00', '09:00:00', '2023-09-18'),
(12, 12, 12, 12, '13:50:00', '12:00:00', '2023-09-18'),
(13, 13, 13, 13, '16:50:00', '14:00:00', '2023-09-19'),
(14, 14, 14, 14, '19:50:00', '18:00:00', '2023-09-19'),
(15, 15, 15, 15, '11:50:00', '09:00:00', '2023-09-20'),
(16, 16, 16, 16, '13:50:00', '12:00:00', '2023-09-20'),
(17, 17, 17, 17, '11:50:00', '09:00:00', '2023-09-21'),
(18, 18, 18, 18, '16:50:00', '14:00:00', '2023-09-21'),
(19, 19, 19, 19, '19:50:00', '18:00:00', '2023-09-21'),
(20, 20, 20, 20, '11:50:00', '11:00:00', '2023-09-22'),
(21, 21, 21, 21, '11:50:00', '09:00:00', '2023-09-25'),
(22, 22, 22, 22, '13:50:00', '12:00:00', '2023-09-25'),
(23, 23, 23, 23, '16:50:00', '14:00:00', '2023-09-26'),
(24, 24, 24, 24, '19:50:00', '18:00:00', '2023-09-26'),
(25, 25, 25, 25, '11:50:00', '09:00:00', '2023-09-27'),
(26, 26, 26, 26, '13:50:00', '12:00:00', '2023-09-27'),
(27, 27, 27, 27, '11:50:00', '09:00:00', '2023-09-28'),
(28, 28, 28, 28, '16:50:00', '14:00:00', '2023-09-28'),
(29, 29, 29, 29, '19:50:00', '18:00:00', '2023-09-28'),
(30, 30, 30, 30, '11:50:00', '11:00:00', '2023-09-29'),
(31, 31, 31, 31, '11:50:00', '09:00:00', '2023-10-02'),
(32, 32, 32, 32, '13:50:00', '12:00:00', '2023-10-02'),
(33, 33, 33, 33, '16:50:00', '14:00:00', '2023-10-03'),
(34, 34, 34, 34, '19:50:00', '18:00:00', '2023-10-03'),
(35, 35, 35, 35, '11:50:00', '09:00:00', '2023-10-04'),
(36, 36, 36, 36, '13:50:00', '12:00:00', '2023-10-04'),
(37, 37, 37, 37, '11:50:00', '09:00:00', '2023-10-05'),
(38, 38, 38, 38, '16:50:00', '14:00:00', '2023-10-05'),
(39, 39, 39, 39, '19:50:00', '18:00:00', '2023-10-05'),
(40, 40, 40, 40, '11:50:00', '11:00:00', '2023-10-06');

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

--
-- Table structure for table `roomnumbers`
--

CREATE TABLE `roomnumbers` (
  `roomnumber_id` int(11) NOT NULL,
  `roomnumber` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `roomnumbers`
--

INSERT INTO `roomnumbers` (`roomnumber_id`, `roomnumber`) VALUES
(1, 'IYH212'),
(2, 'SGM101'),
(3, 'IYH210'),
(4, 'IYH212'),
(5, 'IYH212'),
(6, 'SGM101'),
(7, 'IYH210'),
(8, 'IYH210'),
(9, 'IYH212'),
(10, 'DMC155'),
(11, 'IYH212'),
(12, 'SGM101'),
(13, 'IYH210'),
(14, 'IYH212'),
(15, 'IYH212'),
(16, 'SGM101'),
(17, 'IYH210'),
(18, 'IYH210'),
(19, 'IYH212'),
(20, 'DMC155'),
(21, 'IYH212'),
(22, 'SGM101'),
(23, 'IYH210'),
(24, 'IYH212'),
(25, 'IYH212'),
(26, 'SGM101'),
(27, 'IYH210'),
(28, 'IYH210'),
(29, 'IYH212'),
(30, 'DMC155'),
(31, 'IYH212'),
(32, 'SGM101'),
(33, 'IYH210'),
(34, 'IYH212'),
(35, 'IYH212'),
(36, 'SGM101'),
(37, 'IYH210'),
(38, 'IYH210'),
(39, 'IYH212'),
(40, 'DMC155');

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

--
-- Stand-in structure for view `schedule_view1`
-- (See below for the actual view)
--
CREATE TABLE `schedule_view1` (
`coursename` varchar(30)
,`type` varchar(30)
,`roomnumber` varchar(30)
,`date` date
,`starttime` time
,`endtime` time
);

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

--
-- Structure for view `schedule_view1`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`djocas`@`localhost` SQL SECURITY DEFINER VIEW `schedule_view1`  AS SELECT `coursenames`.`coursename` AS `coursename`, `classtypes`.`type` AS `type`, `roomnumbers`.`roomnumber` AS `roomnumber`, `mainschedule`.`date` AS `date`, `mainschedule`.`starttime` AS `starttime`, `mainschedule`.`endtime` AS `endtime` FROM (((`classtypes` join `coursenames`) join `mainschedule`) join `roomnumbers`) WHERE ((`mainschedule`.`roomnumber_id` = `roomnumbers`.`roomnumber_id`) AND (`mainschedule`.`type_id` = `classtypes`.`type_id`) AND (`mainschedule`.`coursename_id` = `coursenames`.`coursename_id`)) ;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `classtypes`
--
ALTER TABLE `classtypes`
  ADD PRIMARY KEY (`type_id`);

--
-- Indexes for table `coursenames`
--
ALTER TABLE `coursenames`
  ADD PRIMARY KEY (`coursename_id`);

--
-- Indexes for table `mainschedule`
--
ALTER TABLE `mainschedule`
  ADD PRIMARY KEY (`mainschedule_id`),
  ADD KEY `coursename_id` (`coursename_id`),
  ADD KEY `roomnumber_id` (`roomnumber_id`),
  ADD KEY `type_id` (`type_id`);

--
-- Indexes for table `roomnumbers`
--
ALTER TABLE `roomnumbers`
  ADD PRIMARY KEY (`roomnumber_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `classtypes`
--
ALTER TABLE `classtypes`
  MODIFY `type_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=41;

--
-- AUTO_INCREMENT for table `coursenames`
--
ALTER TABLE `coursenames`
  MODIFY `coursename_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=41;

--
-- AUTO_INCREMENT for table `mainschedule`
--
ALTER TABLE `mainschedule`
  MODIFY `mainschedule_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=41;

--
-- AUTO_INCREMENT for table `roomnumbers`
--
ALTER TABLE `roomnumbers`
  MODIFY `roomnumber_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=41;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `mainschedule`
--
ALTER TABLE `mainschedule`
  ADD CONSTRAINT `mainschedule_ibfk_1` FOREIGN KEY (`coursename_id`) REFERENCES `coursenames` (`coursename_id`),
  ADD CONSTRAINT `mainschedule_ibfk_2` FOREIGN KEY (`roomnumber_id`) REFERENCES `roomnumbers` (`roomnumber_id`),
  ADD CONSTRAINT `mainschedule_ibfk_3` FOREIGN KEY (`type_id`) REFERENCES `classtypes` (`type_id`);
COMMIT;

