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

START TRANSACTION;



--
-- Database: `jksung_schedule`
--

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

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

CREATE TABLE `classes` (
  `classID` int(11) NOT NULL,
  `class` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

INSERT INTO `classes` (`classID`, `class`) VALUES
(1, 'HIST266: Business and East Asian Culture, 1800-Present'),
(2, 'ACAD276: Dev II'),
(3, 'ITP215: Introduction to 3D Modeling, Animation, and Visual Effects'),
(4, 'ACAD240: Materials: Denim to Nanotubes'),
(5, 'ACAD324: The Practice of Design: Ideation to Innovation');

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

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

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

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

INSERT INTO `locations` (`locationID`, `location`) VALUES
(1, 'THH 301'),
(2, 'DMC 160'),
(3, 'IYH 210/211'),
(4, 'KAP 107'),
(5, 'IYH 212/213');

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

--
-- Table structure for table `schedules`
--

CREATE TABLE `schedules` (
  `scheduleID` int(11) NOT NULL,
  `date` date NOT NULL,
  `start` time NOT NULL,
  `end` time NOT NULL,
  `classID` int(11) NOT NULL,
  `typeID` int(11) NOT NULL,
  `locationID` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `schedules`
--

INSERT INTO `schedules` (`scheduleID`, `date`, `start`, `end`, `classID`, `typeID`, `locationID`) VALUES
(1, '2023-09-11', '09:00:00', '11:50:00', 5, 1, 5),
(2, '2023-09-12', '10:00:00', '11:50:00', 3, 2, 4),
(3, '2023-09-12', '12:30:00', '13:50:00', 1, 1, 1),
(4, '2023-09-12', '14:00:00', '16:50:00', 2, 1, 3),
(5, '2023-09-12', '18:00:00', '20:00:00', 4, 1, 5),
(6, '2023-09-13', '09:00:00', '11:50:00', 5, 1, 5),
(7, '2023-09-14', '10:00:00', '11:50:00', 3, 2, 4),
(8, '2023-09-14', '12:30:00', '13:50:00', 1, 1, 1),
(9, '2023-09-14', '14:00:00', '16:50:00', 2, 1, 3),
(10, '2023-09-14', '18:00:00', '20:00:00', 4, 1, 5),
(11, '2023-09-15', '09:00:00', '09:50:00', 1, 3, 2),
(12, '2023-09-18', '09:00:00', '11:50:00', 5, 1, 5),
(13, '2023-09-19', '10:00:00', '11:50:00', 3, 2, 4),
(14, '2023-09-19', '12:30:00', '13:50:00', 1, 1, 1),
(15, '2023-09-19', '14:00:00', '16:50:00', 2, 1, 3),
(16, '2023-09-19', '18:00:00', '20:00:00', 4, 1, 5),
(17, '2023-09-20', '09:00:00', '11:50:00', 5, 1, 5),
(18, '2023-09-21', '10:00:00', '11:50:00', 3, 2, 4),
(19, '2023-09-21', '12:30:00', '13:50:00', 1, 1, 1),
(20, '2023-09-21', '14:00:00', '16:50:00', 2, 1, 3),
(21, '2023-09-21', '18:00:00', '20:00:00', 4, 1, 5),
(22, '2023-09-22', '09:00:00', '09:50:00', 1, 3, 2),
(23, '2023-09-25', '09:00:00', '11:50:00', 5, 1, 5),
(24, '2023-09-26', '10:00:00', '11:50:00', 3, 2, 4),
(25, '2023-09-26', '12:30:00', '13:50:00', 1, 1, 1),
(26, '2023-09-26', '14:00:00', '16:50:00', 2, 1, 3),
(27, '2023-09-26', '18:00:00', '20:00:00', 4, 1, 5),
(28, '2023-09-27', '09:00:00', '11:50:00', 5, 1, 5),
(29, '2023-09-28', '10:00:00', '11:50:00', 3, 2, 4),
(30, '2023-09-28', '12:30:00', '13:50:00', 1, 1, 1),
(31, '2023-09-28', '14:00:00', '16:50:00', 2, 1, 3),
(32, '2023-09-28', '18:00:00', '20:00:00', 4, 1, 5),
(33, '2023-09-29', '09:00:00', '09:50:00', 1, 3, 2),
(34, '2023-10-02', '09:00:00', '11:50:00', 5, 1, 5),
(35, '2023-10-03', '10:00:00', '11:50:00', 3, 2, 4),
(36, '2023-10-03', '12:30:00', '13:50:00', 1, 1, 1),
(37, '2023-10-03', '14:00:00', '16:50:00', 2, 1, 3),
(38, '2023-10-03', '18:00:00', '20:00:00', 4, 1, 5),
(39, '2023-10-04', '09:00:00', '11:50:00', 5, 1, 5),
(40, '2023-10-05', '10:00:00', '11:50:00', 3, 2, 4),
(41, '2023-10-05', '12:30:00', '13:50:00', 1, 1, 1),
(42, '2023-10-05', '14:00:00', '16:50:00', 2, 1, 3),
(43, '2023-10-05', '18:00:00', '20:00:00', 4, 1, 5),
(44, '2023-10-06', '09:00:00', '09:50:00', 1, 3, 2);

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

--
-- Stand-in structure for view `schedule_view`
-- (See below for the actual view)
--
CREATE TABLE `schedule_view` (
`date` date
,`start` time
,`end` time
,`class` varchar(100)
,`type` varchar(25)
,`location` varchar(25)
);

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

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

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

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

INSERT INTO `types` (`typeID`, `type`) VALUES
(1, 'Lecture'),
(2, 'Lecture-Lab'),
(3, 'Discussion');

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

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

CREATE ALGORITHM=UNDEFINED DEFINER=`jksung`@`%` SQL SECURITY DEFINER VIEW `schedule_view`  AS SELECT `schedules`.`date` AS `date`, `schedules`.`start` AS `start`, `schedules`.`end` AS `end`, `classes`.`class` AS `class`, `types`.`type` AS `type`, `locations`.`location` AS `location` FROM (((`schedules` join `classes`) join `locations`) join `types`) WHERE ((`schedules`.`classID` = `classes`.`classID`) AND (`schedules`.`locationID` = `locations`.`locationID`) AND (`schedules`.`typeID` = `types`.`typeID`)) ;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `classes`
--
ALTER TABLE `classes`
  ADD PRIMARY KEY (`classID`);

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

--
-- Indexes for table `schedules`
--
ALTER TABLE `schedules`
  ADD PRIMARY KEY (`scheduleID`);

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

--
-- AUTO_INCREMENT for dumped tables
--

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

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

--
-- AUTO_INCREMENT for table `schedules`
--
ALTER TABLE `schedules`
  MODIFY `scheduleID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=45;

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

