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

START TRANSACTION;



--
-- Database: `ellu_schedule`
--

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

--
-- Table structure for table `class`
--

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

--
-- Dumping data for table `class`
--

INSERT INTO `class` (`classID`, `class`) VALUES
(1, 'ACAD 324: The Practice of Design: Ideation to Innovation'),
(2, 'ITP 259: Basics of Artificial Intelligence'),
(3, 'ACAD 276: Dev II '),
(4, 'ACAD 240: Materials: Denim to Nanotubes'),
(5, 'ITP 216: Applied Python');

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

--
-- Table structure for table `location`
--

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

--
-- Dumping data for table `location`
--

INSERT INTO `location` (`locationID`, `location`) VALUES
(1, 'IYH212/213'),
(2, 'KAP145'),
(3, 'IYH210/211'),
(4, 'GFS101');

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

--
-- Table structure for table `schedule`
--

CREATE TABLE `schedule` (
  `id` int(11) NOT NULL,
  `date` date NOT NULL,
  `startTime` time NOT NULL,
  `endTime` time NOT NULL,
  `locationID` int(11) NOT NULL,
  `typeID` int(11) NOT NULL,
  `classID` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `schedule`
--

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

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

--
-- Table structure for table `type`
--

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

--
-- Dumping data for table `type`
--

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

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

--
-- Stand-in structure for view `viewAll`
-- (See below for the actual view)
--
CREATE TABLE `viewAll` (
`date` date
,`startTime` time
,`endTime` time
,`location` varchar(10)
,`type` varchar(50)
,`class` varchar(60)
);

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

--
-- Structure for view `viewAll`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`ellu`@`localhost` SQL SECURITY DEFINER VIEW `viewAll`  AS SELECT `schedule`.`date` AS `date`, `schedule`.`startTime` AS `startTime`, `schedule`.`endTime` AS `endTime`, `location`.`location` AS `location`, `type`.`type` AS `type`, `class`.`class` AS `class` FROM (((`schedule` join `type`) join `class`) join `location`) WHERE ((`schedule`.`typeID` = `type`.`typeID`) AND (`schedule`.`classID` = `class`.`classID`) AND (`schedule`.`locationID` = `location`.`locationID`)) ;

--
-- Indexes for dumped tables
--

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

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

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

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

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

