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

START TRANSACTION;



--
-- Database: `emartial_schedule`
--

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

--
-- Table structure for table `class_name`
--

CREATE TABLE `class_name` (
  `id` int(11) NOT NULL,
  `name` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `class_name`
--

INSERT INTO `class_name` (`id`, `name`) VALUES
(1, 'ITP 259: Basics of Artificial Intelligence'),
(2, 'ACAD 276: Dev II'),
(3, 'ITP 216: Applied Python'),
(4, 'ACAD 324: The Practice of Design: Ideation to Innovation'),
(5, 'ACAD 207: Digital Narratives'),
(6, 'testing class');

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

--
-- Table structure for table `class_type`
--

CREATE TABLE `class_type` (
  `classtype_id` int(11) NOT NULL,
  `type` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `class_type`
--

INSERT INTO `class_type` (`classtype_id`, `type`) VALUES
(1, 'Lecture'),
(2, 'Lab'),
(3, 'Lecture-Lab');

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

--
-- Table structure for table `meetings`
--

CREATE TABLE `meetings` (
  `date` date NOT NULL,
  `start_time` time NOT NULL,
  `end_time` time NOT NULL,
  `room_id` int(11) NOT NULL,
  `classtype_id` int(11) NOT NULL,
  `class_name_id` int(11) NOT NULL,
  `meeting_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `meetings`
--

INSERT INTO `meetings` (`date`, `start_time`, `end_time`, `room_id`, `classtype_id`, `class_name_id`, `meeting_id`) VALUES
('2023-09-11', '09:00:00', '11:50:00', 3, 1, 4, 1),
('2023-09-12', '12:00:00', '13:50:00', 1, 1, 1, 5),
('2023-09-12', '14:00:00', '16:50:00', 4, 1, 2, 6),
('2023-09-12', '18:00:00', '19:50:00', 2, 3, 3, 7),
('2023-09-13', '09:00:00', '11:50:00', 3, 1, 4, 8),
('2023-09-13', '18:00:00', '20:20:00', 3, 1, 5, 9),
('2023-09-14', '12:00:00', '13:50:00', 1, 1, 1, 10),
('2023-09-14', '14:00:00', '16:50:00', 4, 1, 2, 11),
('2023-09-18', '09:00:00', '11:50:00', 3, 1, 4, 12),
('2023-09-18', '18:00:00', '20:20:00', 3, 1, 5, 13),
('2023-09-19', '12:00:00', '13:50:00', 1, 1, 1, 14),
('2023-09-19', '14:00:00', '16:50:00', 4, 1, 2, 15),
('2023-09-19', '18:00:00', '19:50:00', 2, 3, 3, 16),
('2023-09-20', '09:00:00', '11:50:00', 3, 1, 4, 17),
('2023-09-20', '18:00:00', '20:20:00', 3, 1, 5, 18),
('2023-09-21', '12:00:00', '13:50:00', 1, 1, 1, 19),
('2023-09-21', '14:00:00', '16:50:00', 4, 1, 2, 20),
('2023-09-25', '09:00:00', '11:50:00', 3, 1, 4, 21),
('2023-09-25', '18:00:00', '20:20:00', 3, 1, 5, 22),
('2023-09-26', '12:00:00', '13:50:00', 1, 1, 1, 23),
('2023-09-26', '14:00:00', '16:50:00', 4, 1, 2, 24),
('2023-09-26', '18:00:00', '19:50:00', 2, 3, 3, 25),
('2023-09-27', '09:00:00', '11:50:00', 3, 1, 4, 26),
('2023-09-27', '18:00:00', '20:20:00', 3, 1, 5, 27),
('2023-09-28', '12:00:00', '13:50:00', 1, 1, 1, 28),
('2023-09-28', '14:00:00', '16:50:00', 4, 1, 2, 29),
('2023-10-02', '09:00:00', '11:50:00', 3, 1, 4, 30),
('2023-10-02', '18:00:00', '20:20:00', 3, 1, 5, 31),
('2023-10-03', '12:00:00', '13:50:00', 1, 1, 1, 32),
('2023-10-03', '14:00:00', '16:50:00', 4, 1, 2, 33),
('2023-10-03', '18:00:00', '19:50:00', 2, 3, 3, 34),
('2023-10-04', '09:00:00', '11:50:00', 3, 1, 4, 35),
('2023-10-04', '18:00:00', '20:20:00', 3, 1, 5, 36),
('2023-10-05', '12:00:00', '13:50:00', 1, 1, 1, 37),
('2023-10-05', '14:00:00', '16:50:00', 4, 1, 2, 38),
('2023-10-09', '09:00:00', '11:50:00', 3, 1, 4, 39),
('2023-10-09', '18:00:00', '20:20:00', 3, 1, 5, 40),
('2023-10-10', '12:00:00', '13:50:00', 1, 1, 1, 41),
('2023-10-10', '14:00:00', '16:50:00', 4, 1, 2, 42),
('2023-10-10', '18:00:00', '19:50:00', 2, 3, 3, 43),
('2023-10-11', '09:00:00', '11:50:00', 3, 1, 4, 44),
('2023-10-11', '18:00:00', '20:20:00', 3, 1, 5, 45),
('2023-10-12', '12:00:00', '13:50:00', 1, 1, 1, 46),
('2023-10-12', '14:00:00', '16:50:00', 4, 1, 2, 47),
('2023-10-16', '09:00:00', '11:50:00', 3, 1, 4, 48),
('2023-10-16', '18:00:00', '20:20:00', 3, 1, 5, 49),
('2023-10-17', '12:00:00', '13:50:00', 1, 1, 1, 50),
('2023-10-17', '14:00:00', '16:50:00', 4, 1, 2, 51),
('2023-10-17', '18:00:00', '19:50:00', 2, 3, 3, 52),
('2023-10-18', '09:00:00', '11:50:00', 3, 1, 4, 53),
('2023-10-18', '18:00:00', '20:20:00', 3, 1, 5, 54),
('2023-10-19', '12:00:00', '13:50:00', 1, 1, 1, 55),
('2023-10-19', '14:00:00', '16:50:00', 4, 1, 2, 56),
('2023-09-01', '09:00:00', '11:50:00', 4, 1, 2, 57),
('2023-01-22', '09:00:00', '10:00:00', 3, 1, 1, 58);

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

--
-- Stand-in structure for view `meetings_view`
-- (See below for the actual view)
--
CREATE TABLE `meetings_view` (
`date` date
,`start_time` time
,`end_time` time
,`name` text
,`type` text
,`room_number` text
);

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

--
-- Table structure for table `rooms`
--

CREATE TABLE `rooms` (
  `room_id` int(11) NOT NULL,
  `room_number` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `rooms`
--

INSERT INTO `rooms` (`room_id`, `room_number`) VALUES
(1, 'KAP145'),
(2, 'KAP160'),
(3, 'IYH210'),
(4, 'IYH212');

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

--
-- Structure for view `meetings_view`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`emartial`@`localhost` SQL SECURITY DEFINER VIEW `meetings_view`  AS SELECT `meetings`.`date` AS `date`, `meetings`.`start_time` AS `start_time`, `meetings`.`end_time` AS `end_time`, `class_name`.`name` AS `name`, `class_type`.`type` AS `type`, `rooms`.`room_number` AS `room_number` FROM (((`meetings` join `class_type`) join `class_name`) join `rooms`) WHERE ((`meetings`.`room_id` = `rooms`.`room_id`) AND (`meetings`.`class_name_id` = `class_name`.`id`) AND (`meetings`.`classtype_id` = `class_type`.`classtype_id`)) ORDER BY `meetings`.`date` ASC ;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `class_name`
--
ALTER TABLE `class_name`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `class_type`
--
ALTER TABLE `class_type`
  ADD PRIMARY KEY (`classtype_id`);

--
-- Indexes for table `meetings`
--
ALTER TABLE `meetings`
  ADD PRIMARY KEY (`meeting_id`),
  ADD KEY `class_name_id` (`class_name_id`),
  ADD KEY `room_id` (`room_id`),
  ADD KEY `classtype_id` (`classtype_id`);

--
-- Indexes for table `rooms`
--
ALTER TABLE `rooms`
  ADD PRIMARY KEY (`room_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `class_name`
--
ALTER TABLE `class_name`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `class_type`
--
ALTER TABLE `class_type`
  MODIFY `classtype_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `meetings`
--
ALTER TABLE `meetings`
  MODIFY `meeting_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=59;

--
-- AUTO_INCREMENT for table `rooms`
--
ALTER TABLE `rooms`
  MODIFY `room_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `meetings`
--
ALTER TABLE `meetings`
  ADD CONSTRAINT `meetings_ibfk_1` FOREIGN KEY (`class_name_id`) REFERENCES `class_name` (`id`),
  ADD CONSTRAINT `meetings_ibfk_2` FOREIGN KEY (`room_id`) REFERENCES `rooms` (`room_id`),
  ADD CONSTRAINT `meetings_ibfk_3` FOREIGN KEY (`classtype_id`) REFERENCES `class_type` (`classtype_id`);
COMMIT;

