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

START TRANSACTION;



--
-- Database: `mayden_schedule`
--

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

--
-- Table structure for table `classes`
--

CREATE TABLE `classes` (
  `class_name_id` int(50) NOT NULL,
  `class` varchar(50) NOT NULL,
  `date_id` int(11) NOT NULL,
  `start_time_id` int(5) NOT NULL,
  `end_time_id` int(5) NOT NULL,
  `location_id` int(20) NOT NULL,
  `type_id` int(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `classes`
--

INSERT INTO `classes` (`class_name_id`, `class`, `date_id`, `start_time_id`, `end_time_id`, `location_id`, `type_id`) VALUES
(1, 'ACAD 324', 1, 1, 1, 1, 3),
(2, 'PHED 104A', 1, 2, 2, 2, 1),
(3, 'PHIL 103', 1, 4, 4, 3, 2),
(4, 'PHIL 103', 2, 4, 4, 4, 1),
(5, 'ACAD 276', 2, 5, 5, 5, 3),
(6, 'ACAD 240', 2, 6, 6, 1, 1),
(7, 'ACAD 324', 3, 1, 1, 1, 3),
(8, 'PHED 104A', 3, 2, 2, 2, 1),
(9, 'PHIL 103', 4, 4, 4, 4, 1),
(10, 'ACAD 276', 4, 5, 5, 5, 3),
(11, 'ACAD 240', 4, 6, 6, 1, 1),
(12, 'ACAD 324', 5, 1, 1, 1, 3),
(13, 'PHED 104A', 5, 2, 2, 2, 1),
(14, 'PHIL 103', 5, 4, 4, 3, 2),
(15, 'PHIL 103', 6, 4, 4, 4, 1),
(16, 'ACAD 276', 6, 5, 5, 5, 3),
(17, 'ACAD 240', 6, 6, 6, 1, 1),
(18, 'ACAD 324', 7, 1, 1, 1, 3),
(19, 'PHED 104A', 7, 2, 2, 2, 1),
(20, 'PHIL 103', 8, 4, 4, 4, 1),
(21, 'ACAD 276', 8, 5, 5, 5, 3),
(22, 'ACAD 240', 8, 6, 6, 1, 1),
(23, 'ACAD 324', 9, 1, 1, 1, 3),
(24, 'PHED 104A', 9, 2, 2, 2, 1),
(25, 'PHIL 103', 9, 4, 4, 3, 2),
(26, 'PHIL 103', 10, 4, 4, 4, 1),
(27, 'ACAD 276', 10, 5, 5, 5, 3),
(28, 'ACAD 240', 10, 6, 6, 1, 1),
(29, 'ACAD 324', 11, 1, 1, 1, 3),
(30, 'PHED 104A', 11, 2, 2, 2, 1),
(31, 'PHIL 103', 12, 4, 4, 4, 1),
(32, 'ACAD 276', 12, 5, 5, 5, 3),
(33, 'ACAD 240', 12, 6, 6, 1, 1),
(34, 'ACAD 324', 13, 1, 1, 1, 3),
(35, 'PHED 104A', 13, 2, 2, 2, 1),
(36, 'PHIL 103', 13, 4, 4, 3, 2),
(37, 'PHIL 103', 14, 4, 4, 4, 1),
(38, 'ACAD 276', 14, 5, 5, 5, 3),
(39, 'ACAD 240', 14, 6, 6, 1, 1),
(40, 'ACAD 324', 15, 1, 1, 1, 3),
(41, 'PHED 104A', 15, 2, 2, 2, 1),
(42, 'PHIL 103', 16, 4, 4, 4, 1),
(43, 'ACAD 276', 16, 5, 5, 5, 3),
(44, 'ACAD 240', 16, 6, 6, 1, 1);

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

--
-- Table structure for table `dates`
--

CREATE TABLE `dates` (
  `date_id` int(11) NOT NULL,
  `date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `dates`
--

INSERT INTO `dates` (`date_id`, `date`) VALUES
(1, '2023-09-11'),
(2, '2023-09-12'),
(3, '2023-09-13'),
(4, '2023-09-14'),
(5, '2023-09-18'),
(6, '2023-09-19'),
(7, '2023-09-20'),
(8, '2023-09-21'),
(9, '2023-09-25'),
(10, '2023-09-26'),
(11, '2023-09-27'),
(12, '2023-09-28'),
(13, '2023-10-02'),
(14, '2023-10-03'),
(15, '2023-10-04'),
(16, '2023-10-05');

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

--
-- Table structure for table `end_times`
--

CREATE TABLE `end_times` (
  `end_time_id` int(11) NOT NULL,
  `end_time` time NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `end_times`
--

INSERT INTO `end_times` (`end_time_id`, `end_time`) VALUES
(1, '11:50:00'),
(2, '12:50:00'),
(3, '13:50:00'),
(4, '12:20:00'),
(5, '16:50:00'),
(6, '19:50:00');

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

--
-- Table structure for table `locations`
--

CREATE TABLE `locations` (
  `location_id` int(11) NOT NULL,
  `location` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `locations`
--

INSERT INTO `locations` (`location_id`, `location`) VALUES
(1, 'IYH 212/213'),
(2, 'PED 201'),
(3, 'MHP 102'),
(4, 'MHP 101'),
(5, 'IYH 210/211');

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

--
-- Stand-in structure for view `mayden_schedule_view1`
-- (See below for the actual view)
--
CREATE TABLE `mayden_schedule_view1` (
`class` varchar(50)
,`date` date
,`end_time` time
,`location` varchar(50)
,`start_time` time
,`type` varchar(20)
);

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

--
-- Table structure for table `start_times`
--

CREATE TABLE `start_times` (
  `start_time_id` int(11) NOT NULL,
  `start_time` time NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `start_times`
--

INSERT INTO `start_times` (`start_time_id`, `start_time`) VALUES
(1, '09:00:00'),
(2, '12:00:00'),
(3, '13:00:00'),
(4, '11:00:00'),
(5, '14:00:00'),
(6, '18:00:00');

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

--
-- Table structure for table `types`
--

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

--
-- Dumping data for table `types`
--

INSERT INTO `types` (`type_id`, `type`) VALUES
(1, 'Lecture'),
(2, 'Discussion'),
(3, 'Lecture/Lab'),
(4, 'Lecture/Discussion');

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

--
-- Structure for view `mayden_schedule_view1`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`mayden`@`localhost` SQL SECURITY DEFINER VIEW `mayden_schedule_view1`  AS SELECT `classes`.`class` AS `class`, `dates`.`date` AS `date`, `end_times`.`end_time` AS `end_time`, `locations`.`location` AS `location`, `start_times`.`start_time` AS `start_time`, `types`.`type` AS `type` FROM (((((`classes` join `dates`) join `end_times`) join `locations`) join `start_times`) join `types`) WHERE ((`classes`.`date_id` = `dates`.`date_id`) AND (`classes`.`start_time_id` = `start_times`.`start_time_id`) AND (`classes`.`end_time_id` = `end_times`.`end_time_id`) AND (`classes`.`location_id` = `locations`.`location_id`) AND (`classes`.`type_id` = `types`.`type_id`)) ;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `classes`
--
ALTER TABLE `classes`
  ADD PRIMARY KEY (`class_name_id`),
  ADD KEY `date_id` (`date_id`),
  ADD KEY `end_time_id` (`end_time_id`),
  ADD KEY `location_id` (`location_id`),
  ADD KEY `start_time_id` (`start_time_id`),
  ADD KEY `type_id` (`type_id`);

--
-- Indexes for table `dates`
--
ALTER TABLE `dates`
  ADD PRIMARY KEY (`date_id`);

--
-- Indexes for table `end_times`
--
ALTER TABLE `end_times`
  ADD PRIMARY KEY (`end_time_id`);

--
-- Indexes for table `locations`
--
ALTER TABLE `locations`
  ADD PRIMARY KEY (`location_id`);

--
-- Indexes for table `start_times`
--
ALTER TABLE `start_times`
  ADD PRIMARY KEY (`start_time_id`);

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

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `classes`
--
ALTER TABLE `classes`
  MODIFY `class_name_id` int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=91;

--
-- AUTO_INCREMENT for table `dates`
--
ALTER TABLE `dates`
  MODIFY `date_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

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

--
-- AUTO_INCREMENT for table `locations`
--
ALTER TABLE `locations`
  MODIFY `location_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `classes`
--
ALTER TABLE `classes`
  ADD CONSTRAINT `classes_ibfk_1` FOREIGN KEY (`date_id`) REFERENCES `dates` (`date_id`),
  ADD CONSTRAINT `classes_ibfk_2` FOREIGN KEY (`end_time_id`) REFERENCES `end_times` (`end_time_id`),
  ADD CONSTRAINT `classes_ibfk_3` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`),
  ADD CONSTRAINT `classes_ibfk_4` FOREIGN KEY (`start_time_id`) REFERENCES `start_times` (`start_time_id`),
  ADD CONSTRAINT `classes_ibfk_5` FOREIGN KEY (`type_id`) REFERENCES `types` (`type_id`);
COMMIT;

