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

START TRANSACTION;



--
-- Database: `zmarcus_schedule`
--

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

--
-- Table structure for table `Class`
--

CREATE TABLE `Class` (
  `ClassID` int(11) NOT NULL,
  `ClassName` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Class`
--

INSERT INTO `Class` (`ClassID`, `ClassName`) VALUES
(1, 'ACAD324: POD'),
(2, 'ACAD276: Dev II'),
(3, 'MUSC102: World Music'),
(4, 'ACAD240: Materials');

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

--
-- Table structure for table `Date`
--

CREATE TABLE `Date` (
  `DateID` int(11) NOT NULL,
  `DateName` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Date`
--

INSERT INTO `Date` (`DateID`, `DateName`) 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`
--

CREATE TABLE `End` (
  `EndID` int(11) NOT NULL,
  `EndName` time NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `End`
--

INSERT INTO `End` (`EndID`, `EndName`) VALUES
(1, '11:50:00'),
(2, '16:50:00'),
(3, '17:50:00'),
(4, '19:50:00');

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

--
-- Stand-in structure for view `realscheduleview`
-- (See below for the actual view)
--
CREATE TABLE `realscheduleview` (
`ClassName` varchar(20)
,`DateName` date
,`EndName` time
,`RoomName` varchar(11)
,`StartName` time
,`TypeName` varchar(11)
);

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

--
-- Table structure for table `Room`
--

CREATE TABLE `Room` (
  `RoomID` int(11) NOT NULL,
  `RoomName` varchar(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Room`
--

INSERT INTO `Room` (`RoomID`, `RoomName`) VALUES
(1, 'IYH 212'),
(2, 'IYH 210'),
(3, 'THH 202');

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

--
-- Table structure for table `Schedule`
--

CREATE TABLE `Schedule` (
  `ScheduleID` int(11) NOT NULL,
  `DateID` int(11) NOT NULL,
  `StartID` int(11) NOT NULL,
  `EndID` int(11) NOT NULL,
  `RoomID` int(25) NOT NULL,
  `TypeID` int(25) NOT NULL,
  `ClassID` int(25) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Schedule`
--

INSERT INTO `Schedule` (`ScheduleID`, `DateID`, `StartID`, `EndID`, `RoomID`, `TypeID`, `ClassID`) VALUES
(1, 1, 1, 1, 1, 1, 1),
(2, 1, 2, 2, 2, 2, 2),
(3, 2, 3, 3, 3, 1, 3),
(4, 2, 4, 4, 1, 1, 4),
(5, 3, 1, 1, 1, 1, 1),
(6, 3, 2, 2, 2, 2, 2),
(7, 4, 3, 3, 3, 1, 3),
(8, 4, 4, 4, 1, 1, 4),
(9, 5, 1, 1, 1, 1, 1),
(10, 5, 2, 2, 2, 2, 2),
(11, 6, 3, 3, 3, 1, 3),
(12, 6, 4, 4, 1, 1, 4),
(13, 7, 1, 1, 1, 1, 1),
(14, 7, 2, 2, 2, 2, 2),
(15, 8, 3, 3, 3, 1, 3),
(16, 8, 4, 4, 1, 1, 4),
(17, 9, 1, 1, 1, 1, 1),
(18, 9, 2, 2, 2, 2, 2),
(19, 10, 3, 3, 3, 1, 3),
(20, 10, 4, 4, 1, 1, 4),
(21, 11, 1, 1, 1, 1, 1),
(22, 11, 2, 2, 2, 2, 2),
(23, 12, 3, 3, 3, 1, 3),
(24, 12, 4, 4, 1, 1, 4),
(25, 13, 1, 1, 1, 1, 1),
(26, 13, 2, 2, 2, 2, 2),
(27, 14, 3, 3, 3, 1, 3),
(28, 14, 4, 4, 1, 1, 4),
(29, 15, 1, 1, 1, 1, 1),
(30, 15, 2, 2, 2, 2, 2),
(31, 16, 3, 3, 3, 1, 3),
(32, 16, 4, 4, 1, 1, 4);

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

--
-- Stand-in structure for view `scheduleview1`
-- (See below for the actual view)
--
CREATE TABLE `scheduleview1` (
`ClassID` int(25)
,`DateID` int(11)
,`EndID` int(11)
,`RoomID` int(25)
,`StartID` int(11)
,`TypeID` int(25)
);

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

--
-- Table structure for table `Start`
--

CREATE TABLE `Start` (
  `StartID` int(11) NOT NULL,
  `StartName` time NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Start`
--

INSERT INTO `Start` (`StartID`, `StartName`) VALUES
(1, '09:00:00'),
(2, '14:00:00'),
(3, '16:00:00'),
(4, '18:00:00');

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

--
-- Table structure for table `Type`
--

CREATE TABLE `Type` (
  `TypeID` int(11) NOT NULL,
  `TypeName` varchar(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Type`
--

INSERT INTO `Type` (`TypeID`, `TypeName`) VALUES
(1, 'Lecture'),
(2, 'Lecture/Lab');

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

--
-- Structure for view `realscheduleview`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`zmarcus`@`localhost` SQL SECURITY DEFINER VIEW `realscheduleview`  AS SELECT `Class`.`ClassName` AS `ClassName`, `Date`.`DateName` AS `DateName`, `End`.`EndName` AS `EndName`, `Room`.`RoomName` AS `RoomName`, `Start`.`StartName` AS `StartName`, `Type`.`TypeName` AS `TypeName` FROM ((((((`Schedule` join `Class`) join `Date`) join `End`) join `Room`) join `Start`) join `Type`) WHERE ((`Schedule`.`ClassID` = `Class`.`ClassID`) AND (`Schedule`.`DateID` = `Date`.`DateID`) AND (`Schedule`.`EndID` = `End`.`EndID`) AND (`Schedule`.`StartID` = `Start`.`StartID`) AND (`Schedule`.`RoomID` = `Room`.`RoomID`) AND (`Schedule`.`TypeID` = `Type`.`TypeID`)) ;

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

--
-- Structure for view `scheduleview1`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`zmarcus`@`localhost` SQL SECURITY DEFINER VIEW `scheduleview1`  AS SELECT `Schedule`.`ClassID` AS `ClassID`, `Schedule`.`DateID` AS `DateID`, `Schedule`.`EndID` AS `EndID`, `Schedule`.`RoomID` AS `RoomID`, `Schedule`.`StartID` AS `StartID`, `Schedule`.`TypeID` AS `TypeID` FROM `Schedule` ;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `Class`
--
ALTER TABLE `Class`
  ADD PRIMARY KEY (`ClassID`);

--
-- Indexes for table `Date`
--
ALTER TABLE `Date`
  ADD PRIMARY KEY (`DateID`);

--
-- Indexes for table `End`
--
ALTER TABLE `End`
  ADD PRIMARY KEY (`EndID`);

--
-- Indexes for table `Room`
--
ALTER TABLE `Room`
  ADD PRIMARY KEY (`RoomID`);

--
-- Indexes for table `Schedule`
--
ALTER TABLE `Schedule`
  ADD PRIMARY KEY (`ScheduleID`),
  ADD KEY `ClassID` (`ClassID`),
  ADD KEY `DateID` (`DateID`),
  ADD KEY `EndID` (`EndID`),
  ADD KEY `RoomID` (`RoomID`),
  ADD KEY `StartID` (`StartID`),
  ADD KEY `TypeID` (`TypeID`);

--
-- Indexes for table `Start`
--
ALTER TABLE `Start`
  ADD PRIMARY KEY (`StartID`);

--
-- 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=5;

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

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

--
-- AUTO_INCREMENT for table `Room`
--
ALTER TABLE `Room`
  MODIFY `RoomID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `Schedule`
--
ALTER TABLE `Schedule`
  MODIFY `ScheduleID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=33;

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `Schedule`
--
ALTER TABLE `Schedule`
  ADD CONSTRAINT `Schedule_ibfk_1` FOREIGN KEY (`ClassID`) REFERENCES `Class` (`ClassID`),
  ADD CONSTRAINT `Schedule_ibfk_2` FOREIGN KEY (`DateID`) REFERENCES `Date` (`DateID`),
  ADD CONSTRAINT `Schedule_ibfk_3` FOREIGN KEY (`EndID`) REFERENCES `End` (`EndID`),
  ADD CONSTRAINT `Schedule_ibfk_4` FOREIGN KEY (`RoomID`) REFERENCES `Room` (`RoomID`),
  ADD CONSTRAINT `Schedule_ibfk_5` FOREIGN KEY (`StartID`) REFERENCES `Start` (`StartID`),
  ADD CONSTRAINT `Schedule_ibfk_6` FOREIGN KEY (`TypeID`) REFERENCES `Type` (`TypeID`);
COMMIT;

