-- phpMyAdmin SQL Dump
-- version 5.2.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Sep 24, 2026 at 09:42 AM
-- Server version: 5.7.44
-- PHP Version: 8.1.34

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: `maysyian_schedule`
--

-- --------------------------------------------------------

--
-- Stand-in structure for view `assignment3b`
-- (See below for the actual view)
--
CREATE TABLE `assignment3b` (
                                `date` date
    ,`starttime` time
    ,`endtime` time
    ,`location` varchar(255)
    ,`session` varchar(255)
    ,`class` varchar(267)
);

-- --------------------------------------------------------

--
-- Stand-in structure for view `assignment4b`
-- (See below for the actual view)
--
CREATE TABLE `assignment4b` (
                                `id` int(11)
    ,`date` date
    ,`class_id` varchar(10)
    ,`class_name` varchar(255)
    ,`class` varchar(267)
    ,`session_id` int(11)
    ,`session_name` varchar(255)
    ,`starttime` time
    ,`endtime` time
    ,`location_id` int(11)
    ,`location_name` varchar(255)
);

-- --------------------------------------------------------

--
-- Table structure for table `class`
--

CREATE TABLE `class` (
                         `class_id` varchar(10) NOT NULL,
                         `class_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `class`
--

INSERT INTO `class` (`class_id`, `class_name`) VALUES
                                                   ('ACAD276', 'Dev II'),
                                                   ('EE443', 'Power Systems'),
                                                   ('LING115', 'Language and Society'),
                                                   ('PHYS153', 'Fundamentals of Physics III: Optics, Thermo, Modern Physics'),
                                                   ('TAC449', 'Applications of Machine Learning');

-- --------------------------------------------------------

--
-- Table structure for table `location`
--

CREATE TABLE `location` (
                            `location_id` int(11) NOT NULL,
                            `location_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `location`
--

INSERT INTO `location` (`location_id`, `location_name`) VALUES
                                                            (1, 'IYH210/211'),
                                                            (2, 'OHE132'),
                                                            (3, 'GFS106'),
                                                            (4, 'GFS216'),
                                                            (5, 'SLH200'),
                                                            (6, ''),
                                                            (7, 'KAPB29'),
                                                            (8, 'GFS101');

-- --------------------------------------------------------

--
-- Table structure for table `schedule`
--

CREATE TABLE `schedule` (
                            `id` int(11) NOT NULL,
                            `date` date NOT NULL,
                            `session_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `schedule`
--

INSERT INTO `schedule` (`id`, `date`, `session_id`) VALUES
                                                        (1, '2026-08-24', 38815),
                                                        (2, '2026-08-24', 50420),
                                                        (3, '2026-08-24', 31890),
                                                        (4, '2026-08-25', 38812),
                                                        (5, '2026-08-25', 10242),
                                                        (6, '2026-08-25', 50427),
                                                        (7, '2026-08-26', 50420),
                                                        (8, '2026-08-26', 50421),
                                                        (9, '2026-08-26', 31890),
                                                        (10, '2026-08-27', 38812),
                                                        (11, '2026-08-27', 10242),
                                                        (12, '2026-08-27', 30496),
                                                        (13, '2026-08-28', 50420),
                                                        (14, '2026-08-31', 38815),
                                                        (15, '2026-08-31', 50420),
                                                        (16, '2026-08-31', 31890),
                                                        (17, '2026-09-01', 38812),
                                                        (18, '2026-09-01', 10242),
                                                        (19, '2026-09-01', 50427),
                                                        (20, '2026-09-02', 50420),
                                                        (21, '2026-09-02', 50421),
                                                        (22, '2026-09-02', 31890),
                                                        (23, '2026-09-03', 38812),
                                                        (24, '2026-09-03', 10242),
                                                        (25, '2026-09-03', 30496),
                                                        (26, '2026-09-04', 50420),
                                                        (27, '2026-09-07', 38815),
                                                        (28, '2026-09-07', 50420),
                                                        (29, '2026-09-07', 31890),
                                                        (30, '2026-09-08', 38812),
                                                        (31, '2026-09-08', 10242),
                                                        (32, '2026-09-08', 50427),
                                                        (33, '2026-09-09', 50420),
                                                        (34, '2026-09-09', 50421),
                                                        (35, '2026-09-09', 31890),
                                                        (36, '2026-09-10', 38812),
                                                        (37, '2026-09-10', 10242),
                                                        (38, '2026-09-10', 30496),
                                                        (39, '2026-09-11', 50420),
                                                        (40, '2026-09-14', 38815),
                                                        (41, '2026-09-14', 50420),
                                                        (42, '2026-09-14', 31890),
                                                        (43, '2026-09-15', 38812),
                                                        (44, '2026-09-15', 10242),
                                                        (45, '2026-09-15', 50427),
                                                        (46, '2026-09-16', 50420),
                                                        (47, '2026-09-16', 50421),
                                                        (48, '2026-09-16', 31890),
                                                        (49, '2026-09-17', 38812),
                                                        (50, '2026-09-17', 10242),
                                                        (51, '2026-09-17', 30496),
                                                        (52, '2026-09-18', 50420);

-- --------------------------------------------------------

--
-- Table structure for table `session`
--

CREATE TABLE `session` (
                           `session_id` int(11) NOT NULL,
                           `session_name` varchar(255) NOT NULL,
                           `class_id` varchar(10) NOT NULL,
                           `starttime` time NOT NULL,
                           `endtime` time NOT NULL,
                           `location_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `session`
--

INSERT INTO `session` (`session_id`, `session_name`, `class_id`, `starttime`, `endtime`, `location_id`) VALUES
                                                                                                            (10242, 'Lecture-Lab', 'ACAD276', '12:00:00', '13:50:00', 1),
                                                                                                            (30496, 'Lecture', 'EE443', '18:00:00', '21:40:00', 2),
                                                                                                            (31890, 'Lecture', 'TAC449', '14:00:00', '15:50:00', 8),
                                                                                                            (38812, 'Lecture', 'LING115', '09:30:00', '10:50:00', 3),
                                                                                                            (38815, 'Discussion', 'LING115', '10:00:00', '10:50:00', 4),
                                                                                                            (50420, 'Lecture', 'PHYS153', '09:00:00', '09:50:00', 5),
                                                                                                            (50421, 'Discussion', 'PHYS153', '17:00:00', '18:20:00', 6),
                                                                                                            (50427, 'Lab', 'PHYS153', '14:00:00', '16:50:00', 7);

--
-- Indexes for dumped tables
--

--
-- Indexes for table `class`
--
ALTER TABLE `class`
    ADD PRIMARY KEY (`class_id`);

--
-- Indexes for table `location`
--
ALTER TABLE `location`
    ADD PRIMARY KEY (`location_id`);

--
-- Indexes for table `schedule`
--
ALTER TABLE `schedule`
    ADD PRIMARY KEY (`id`),
  ADD KEY `fk_session_id_idx` (`session_id`);

--
-- Indexes for table `session`
--
ALTER TABLE `session`
    ADD PRIMARY KEY (`session_id`),
  ADD KEY `fk_class_id_idx` (`class_id`),
  ADD KEY `fk_location_id_idx` (`location_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `location`
--
ALTER TABLE `location`
    MODIFY `location_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `schedule`
--
ALTER TABLE `schedule`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=53;

-- --------------------------------------------------------

--
-- Structure for view `assignment3b`
--
DROP TABLE IF EXISTS `assignment3b`;

CREATE ALGORITHM=UNDEFINED DEFINER=`maysyian`@`localhost` SQL SECURITY DEFINER VIEW `assignment3b`  AS SELECT `schedule`.`date` AS `date`, `session`.`starttime` AS `starttime`, `session`.`endtime` AS `endtime`, `location`.`location_name` AS `location`, `session`.`session_name` AS `session`, concat(`class`.`class_id`,': ',`class`.`class_name`) AS `class` FROM (((`schedule` join `session`) join `class`) join `location`) WHERE ((`schedule`.`session_id` = `session`.`session_id`) AND (`session`.`class_id` = `class`.`class_id`) AND (`session`.`location_id` = `location`.`location_id`)) ORDER BY `schedule`.`date` ASC, `session`.`starttime` ASC ;

-- --------------------------------------------------------

--
-- Structure for view `assignment4b`
--
DROP TABLE IF EXISTS `assignment4b`;

CREATE ALGORITHM=UNDEFINED DEFINER=`maysyian`@`localhost` SQL SECURITY DEFINER VIEW `assignment4b`  AS SELECT `schedule`.`id` AS `id`, `schedule`.`date` AS `date`, `class`.`class_id` AS `class_id`, `class`.`class_name` AS `class_name`, concat(`class`.`class_id`,': ',`class`.`class_name`) AS `class`, `session`.`session_id` AS `session_id`, `session`.`session_name` AS `session_name`, `session`.`starttime` AS `starttime`, `session`.`endtime` AS `endtime`, `location`.`location_id` AS `location_id`, `location`.`location_name` AS `location_name` FROM (((`session` join `schedule`) join `location`) join `class`) WHERE ((`schedule`.`session_id` = `session`.`session_id`) AND (`session`.`class_id` = `class`.`class_id`) AND (`session`.`location_id` = `location`.`location_id`)) ORDER BY `schedule`.`id` ASC ;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `schedule`
--
ALTER TABLE `schedule`
    ADD CONSTRAINT `fk_schedule_session` FOREIGN KEY (`session_id`) REFERENCES `session` (`session_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

--
-- Constraints for table `session`
--
ALTER TABLE `session`
    ADD CONSTRAINT `fk_session_class` FOREIGN KEY (`class_id`) REFERENCES `class` (`class_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `fk_session_location` FOREIGN KEY (`location_id`) REFERENCES `location` (`location_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
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 */;
