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

START TRANSACTION;



--
-- Database: `lggraham_schedule`
--

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

--
-- Table structure for table `classTypes`
--

CREATE TABLE `classTypes` (
  `classType_id` int(11) NOT NULL,
  `classType` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `classTypes`
--

INSERT INTO `classTypes` (`classType_id`, `classType`) VALUES
(1, 'Lecture'),
(2, 'Lab'),
(3, 'Lecture/Lab'),
(4, 'Meeting');

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

--
-- 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, 'THH101'),
(3, 'IYH210/211'),
(4, 'IYH212/213'),
(5, 'IYH212/213'),
(6, 'Online');

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

--
-- Table structure for table `mySchedule`
--

CREATE TABLE `mySchedule` (
  `classNum` int(11) NOT NULL,
  `date` date NOT NULL,
  `startTime` time NOT NULL,
  `endTime` time NOT NULL,
  `location_id` int(11) NOT NULL,
  `classType_id` int(11) NOT NULL,
  `name_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `mySchedule`
--

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

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

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

CREATE TABLE `names` (
  `name_id` int(11) NOT NULL,
  `name` varchar(100) 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: Ideation to Innovation'),
(2, 'PSYC 100: Introduction to Psychology'),
(3, 'ACAD 276: Dev II '),
(4, 'ACAD 240: Materials: Denim to Nanotubes '),
(5, 'Work Weekly Check-In');

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

--
-- Stand-in structure for view `View1`
-- (See below for the actual view)
--
CREATE TABLE `View1` (
`date` date
,`startTime` time
,`endTime` time
,`location` varchar(25)
,`classType` varchar(50)
,`name` varchar(100)
);

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

--
-- Structure for view `View1`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`lggraham`@`localhost` SQL SECURITY DEFINER VIEW `View1`  AS SELECT `mySchedule`.`date` AS `date`, `mySchedule`.`startTime` AS `startTime`, `mySchedule`.`endTime` AS `endTime`, `locations`.`location` AS `location`, `classTypes`.`classType` AS `classType`, `names`.`name` AS `name` FROM (((`mySchedule` join `locations`) join `classTypes`) join `names`) WHERE ((`mySchedule`.`location_id` = `locations`.`location_id`) AND (`mySchedule`.`classType_id` = `classTypes`.`classType_id`) AND (`mySchedule`.`name_id` = `names`.`name_id`)) ORDER BY `mySchedule`.`date` ASC ;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `classTypes`
--
ALTER TABLE `classTypes`
  ADD PRIMARY KEY (`classType_id`);

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

--
-- Indexes for table `mySchedule`
--
ALTER TABLE `mySchedule`
  ADD PRIMARY KEY (`classNum`),
  ADD KEY `classType_id` (`classType_id`),
  ADD KEY `location_id` (`location_id`),
  ADD KEY `name_id` (`name_id`);

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

--
-- AUTO_INCREMENT for dumped tables
--

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

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

--
-- AUTO_INCREMENT for table `mySchedule`
--
ALTER TABLE `mySchedule`
  MODIFY `classNum` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=42;

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `mySchedule`
--
ALTER TABLE `mySchedule`
  ADD CONSTRAINT `mySchedule_ibfk_1` FOREIGN KEY (`classType_id`) REFERENCES `classTypes` (`classType_id`),
  ADD CONSTRAINT `mySchedule_ibfk_2` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`),
  ADD CONSTRAINT `mySchedule_ibfk_3` FOREIGN KEY (`name_id`) REFERENCES `names` (`name_id`);
COMMIT;

