-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Sep 19, 2024 at 12:53 PM
-- Server version: 5.7.44
-- PHP Version: 8.1.29

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `bkpowell__schedule`
--

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

--
-- Table structure for table `courses`
--

CREATE TABLE `courses` (
  `course_id` int(11) NOT NULL,
  `course_name` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `courses`
--

INSERT INTO `courses` (`course_id`, `course_name`) VALUES
(1, 'ACAD182: Case Studies'),
(2, 'ACAD324: Practice of Design'),
(3, 'ACAD276: Dev II'),
(4, 'MUSC320: Hip-hop Music and Culture');

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

--
-- Table structure for table `course_schedule`
--

CREATE TABLE `course_schedule` (
  `schedule_id` int(11) NOT NULL,
  `meeting_date` date NOT NULL,
  `start_time` time NOT NULL,
  `end_time` time NOT NULL,
  `course_id` int(11) NOT NULL,
  `location_id` int(11) NOT NULL,
  `class_type_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `course_schedule`
--

INSERT INTO `course_schedule` (`schedule_id`, `meeting_date`, `start_time`, `end_time`, `course_id`, `location_id`, `class_type_id`) VALUES
(1, '2024-09-16', '10:00:00', '11:50:00', 1, 1, 1),
(2, '2024-09-17', '09:00:00', '11:50:00', 2, 2, 2),
(3, '2024-09-17', '02:00:00', '04:50:00', 3, 3, 2),
(4, '2024-09-17', '06:00:00', '07:50:00', 4, 4, 1),
(5, '2024-09-18', '10:00:00', '11:50:00', 1, 1, 1),
(6, '2024-09-19', '09:00:00', '11:50:00', 2, 2, 2),
(7, '2024-09-19', '02:00:00', '04:50:00', 3, 3, 2),
(8, '2024-09-19', '06:00:00', '07:50:00', 4, 4, 1),
(9, '2024-09-23', '10:00:00', '11:50:00', 1, 1, 1),
(10, '2024-09-24', '09:00:00', '11:50:00', 2, 2, 2),
(11, '2024-09-24', '02:00:00', '04:50:00', 3, 3, 2),
(12, '2024-09-24', '06:00:00', '07:50:00', 4, 4, 1),
(13, '2024-09-25', '10:00:00', '11:50:00', 1, 1, 1),
(14, '2024-09-26', '09:00:00', '11:50:00', 2, 2, 2),
(15, '2024-09-26', '02:00:00', '04:50:00', 3, 3, 2),
(16, '2024-09-26', '06:00:00', '07:50:00', 4, 4, 1),
(17, '2024-09-30', '10:00:00', '11:50:00', 1, 1, 1),
(18, '2024-10-01', '09:00:00', '11:50:00', 2, 2, 2),
(20, '2024-10-01', '02:00:00', '04:50:00', 3, 3, 2),
(21, '2024-10-01', '06:00:00', '07:50:00', 4, 4, 1),
(22, '2024-10-02', '10:00:00', '11:50:00', 1, 1, 1),
(23, '2024-10-03', '09:00:00', '11:50:00', 2, 2, 2),
(24, '2024-10-03', '02:00:00', '04:50:00', 3, 3, 2),
(25, '2024-10-03', '06:00:00', '07:50:00', 4, 4, 1),
(26, '2024-10-07', '10:00:00', '11:50:00', 1, 1, 1),
(27, '2024-10-08', '09:00:00', '11:50:00', 2, 2, 2),
(28, '2024-10-08', '02:00:00', '04:50:00', 3, 3, 2),
(29, '2024-10-08', '06:00:00', '07:50:00', 4, 4, 1),
(33, '2024-10-09', '10:00:00', '11:50:00', 1, 1, 1),
(34, '2024-10-10', '09:00:00', '11:50:00', 2, 2, 2),
(35, '2024-10-10', '02:00:00', '04:50:00', 3, 3, 2),
(36, '2024-10-10', '06:00:00', '07:50:00', 4, 4, 1);

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

--
-- Stand-in structure for view `full_schedule_view`
-- (See below for the actual view)
--
CREATE TABLE `full_schedule_view` (
`schedule_id` int(11)
,`meeting_date` date
,`start_time` time
,`end_time` time
,`course_name` varchar(50)
,`location_name` varchar(50)
,`type_name` varchar(50)
);

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

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

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

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

INSERT INTO `locations` (`location_id`, `location_name`) VALUES
(1, 'IYH212'),
(2, 'IYH212/213'),
(3, 'IYH210/211'),
(4, 'THH202');

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

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

CREATE TABLE `types` (
  `class_type_id` int(11) NOT NULL,
  `type_name` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

INSERT INTO `types` (`class_type_id`, `type_name`) VALUES
(1, 'Lecture'),
(2, 'Lecture/Lab');

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

--
-- Structure for view `full_schedule_view`
--
DROP TABLE IF EXISTS `full_schedule_view`;

CREATE ALGORITHM=UNDEFINED DEFINER=`bkpowell`@`localhost` SQL SECURITY DEFINER VIEW `full_schedule_view`  AS SELECT `course_schedule`.`schedule_id` AS `schedule_id`, `course_schedule`.`meeting_date` AS `meeting_date`, `course_schedule`.`start_time` AS `start_time`, `course_schedule`.`end_time` AS `end_time`, `courses`.`course_name` AS `course_name`, `locations`.`location_name` AS `location_name`, `types`.`type_name` AS `type_name` FROM (((`course_schedule` join `courses`) join `locations`) join `types`) WHERE ((`course_schedule`.`course_id` = `courses`.`course_id`) AND (`course_schedule`.`location_id` = `locations`.`location_id`) AND (`course_schedule`.`class_type_id` = `types`.`class_type_id`)) ;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `courses`
--
ALTER TABLE `courses`
  ADD PRIMARY KEY (`course_id`);

--
-- Indexes for table `course_schedule`
--
ALTER TABLE `course_schedule`
  ADD PRIMARY KEY (`schedule_id`),
  ADD KEY `course_id` (`course_id`),
  ADD KEY `location_id` (`location_id`),
  ADD KEY `class_type_id` (`class_type_id`);

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

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

--
-- AUTO_INCREMENT for dumped tables
--

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

--
-- AUTO_INCREMENT for table `course_schedule`
--
ALTER TABLE `course_schedule`
  MODIFY `schedule_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=37;

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `course_schedule`
--
ALTER TABLE `course_schedule`
  ADD CONSTRAINT `course_schedule_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`),
  ADD CONSTRAINT `course_schedule_ibfk_2` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`),
  ADD CONSTRAINT `course_schedule_ibfk_3` FOREIGN KEY (`class_type_id`) REFERENCES `types` (`class_type_id`);
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
