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

START TRANSACTION;



--
-- Database: `sandmanl_schedule`
--

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

--
-- Table structure for table `class_schedule`
--

CREATE TABLE `class_schedule` (
  `class_schedule_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `start_time` time NOT NULL,
  `end_time` time NOT NULL,
  `location_id` int(11) NOT NULL,
  `type_id` int(11) NOT NULL,
  `name_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `class_schedule`
--

INSERT INTO `class_schedule` (`class_schedule_id`, `date`, `start_time`, `end_time`, `location_id`, `type_id`, `name_id`) VALUES
(1, '2023-09-11', '09:00:00', '12:00:00', 1, 1, 1),
(2, '2023-09-11', '17:30:00', '18:30:00', 2, 1, 2),
(3, '2023-09-11', '19:00:00', '22:00:00', 3, 1, 3),
(4, '2023-09-12', '10:00:00', '11:00:00', 4, 2, 2),
(5, '2023-09-12', '14:00:00', '17:00:00', 5, 1, 4),
(6, '2023-09-12', '18:00:00', '20:00:00', 1, 1, 5),
(7, '2023-09-13', '09:00:00', '12:00:00', 1, 1, 1),
(8, '2023-09-13', '17:30:00', '18:30:00', 2, 1, 2),
(9, '2023-09-14', '14:00:00', '17:00:00', 5, 1, 4),
(10, '2023-09-14', '18:00:00', '20:00:00', 1, 1, 5),
(11, '2023-09-18', '09:00:00', '12:00:00', 1, 1, 1),
(12, '2023-09-18', '17:30:00', '18:30:00', 2, 1, 2),
(13, '2023-09-18', '19:00:00', '22:00:00', 3, 1, 3),
(14, '2023-09-19', '10:00:00', '11:00:00', 4, 2, 2),
(15, '2023-09-19', '14:00:00', '17:00:00', 5, 1, 4),
(16, '2023-09-19', '18:00:00', '20:00:00', 1, 1, 5),
(17, '2023-09-20', '09:00:00', '12:00:00', 1, 1, 1),
(18, '2023-09-20', '17:30:00', '18:30:00', 2, 1, 2),
(19, '2023-09-21', '14:00:00', '17:00:00', 5, 1, 4),
(20, '2023-09-21', '18:00:00', '20:00:00', 1, 1, 5),
(21, '2023-09-25', '09:00:00', '12:00:00', 1, 1, 1),
(22, '2023-09-25', '17:30:00', '18:30:00', 2, 1, 2),
(23, '2023-09-25', '19:00:00', '22:00:00', 3, 1, 3),
(24, '2023-09-26', '10:00:00', '11:00:00', 4, 2, 2),
(25, '2023-09-26', '14:00:00', '17:00:00', 5, 1, 4),
(26, '2023-09-26', '18:00:00', '20:00:00', 1, 1, 5),
(27, '2023-09-27', '09:00:00', '12:00:00', 1, 1, 1),
(28, '2023-09-27', '17:30:00', '18:30:00', 2, 1, 2),
(29, '2023-09-28', '14:00:00', '17:00:00', 5, 1, 4),
(30, '2023-09-28', '18:00:00', '20:00:00', 1, 1, 5),
(31, '2023-10-02', '09:00:00', '12:00:00', 1, 1, 1),
(32, '2023-10-02', '17:30:00', '18:30:00', 2, 1, 2),
(33, '2023-10-02', '19:00:00', '22:00:00', 3, 1, 3),
(34, '2023-10-03', '10:00:00', '11:00:00', 4, 2, 2),
(35, '2023-10-03', '14:00:00', '17:00:00', 5, 1, 4),
(36, '2023-10-03', '18:00:00', '20:00:00', 1, 1, 5),
(37, '2023-10-04', '09:00:00', '12:00:00', 1, 1, 1),
(38, '2023-10-04', '17:30:00', '18:30:00', 2, 1, 2),
(39, '2023-10-05', '14:00:00', '17:00:00', 5, 1, 4),
(40, '2023-10-05', '18:00:00', '20:00:00', 1, 1, 5),
(43, '2023-09-23', '00:00:00', '01:00:00', 1, 1, 10);

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

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

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

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

INSERT INTO `locations` (`location_id`, `location`) VALUES
(1, 'IYH212/213'),
(2, 'THH102'),
(3, 'SCA356'),
(4, 'WPH205'),
(5, 'IYH210/211');

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

--
-- Table structure for table `names`
--

CREATE TABLE `names` (
  `name_id` int(11) NOT NULL,
  `name` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `names`
--

INSERT INTO `names` (`name_id`, `name`) VALUES
(1, 'ACAD-324: The Practice of Design'),
(2, 'PHIL-260: Ethical Theory and Practice'),
(3, 'CTPR-335: Motion Picture Editing'),
(4, 'ACAD-276: Dev II'),
(5, 'ACAD-240 : Materials: Denim to Nanotubes'),
(10, 'test');

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

--
-- Stand-in structure for view `scheduleView2`
-- (See below for the actual view)
--
CREATE TABLE `scheduleView2` (
`class_schedule_id` int(11)
,`date` date
,`start_time` time
,`end_time` time
,`location_id` int(11)
,`type_id` int(11)
,`name_id` int(11)
,`location` varchar(25)
,`name` varchar(50)
,`type` varchar(25)
);

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

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

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

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

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

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

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

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

--
-- Structure for view `scheduleView2`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`sandmanl`@`localhost` SQL SECURITY DEFINER VIEW `scheduleView2`  AS SELECT `class_schedule`.`class_schedule_id` AS `class_schedule_id`, `class_schedule`.`date` AS `date`, `class_schedule`.`start_time` AS `start_time`, `class_schedule`.`end_time` AS `end_time`, `class_schedule`.`location_id` AS `location_id`, `class_schedule`.`type_id` AS `type_id`, `class_schedule`.`name_id` AS `name_id`, `locations`.`location` AS `location`, `names`.`name` AS `name`, `types`.`type` AS `type` FROM (((`class_schedule` join `locations`) join `names`) join `types`) WHERE ((`class_schedule`.`location_id` = `locations`.`location_id`) AND (`class_schedule`.`name_id` = `names`.`name_id`) AND (`class_schedule`.`type_id` = `types`.`type_id`)) ;

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

--
-- Structure for view `schedule_view`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`sandmanl`@`%` SQL SECURITY DEFINER VIEW `schedule_view`  AS SELECT `class_schedule`.`date` AS `date`, `class_schedule`.`start_time` AS `start_time`, `class_schedule`.`end_time` AS `end_time`, `locations`.`location` AS `location`, `types`.`type` AS `type`, `names`.`name` AS `name` FROM (((`class_schedule` join `locations`) join `names`) join `types`) WHERE ((`class_schedule`.`location_id` = `locations`.`location_id`) AND (`class_schedule`.`type_id` = `types`.`type_id`) AND (`class_schedule`.`name_id` = `names`.`name_id`)) ;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `class_schedule`
--
ALTER TABLE `class_schedule`
  ADD PRIMARY KEY (`class_schedule_id`);

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

--
-- Indexes for table `names`
--
ALTER TABLE `names`
  ADD PRIMARY KEY (`name_id`);

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

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `class_schedule`
--
ALTER TABLE `class_schedule`
  MODIFY `class_schedule_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=44;

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

--
-- AUTO_INCREMENT for table `names`
--
ALTER TABLE `names`
  MODIFY `name_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

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

