You are on page 1of 16

-- phpMyAdmin SQL Dump

-- version 4.9.7

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

--

-- Host: localhost:8889

-- Generation Time: May 13, 2021 at 02:27 AM

-- Server version: 5.7.32

-- PHP Version: 7.4.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";

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: `test_db`

--

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

--

-- Table structure for table `combinations`

--

CREATE TABLE `combinations` (


`combination_id` int(11) NOT NULL,

`logical_operator` varchar(10) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--

-- Dumping data for table `combinations`

--

INSERT INTO `combinations` (`combination_id`, `logical_operator`) VALUES

(301, 'AND'),

(302, 'OR');

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

--

-- Table structure for table `combination_courses`

--

CREATE TABLE `combination_courses` (

`combination_id` int(11) DEFAULT NULL,

`course_id` varchar(20) DEFAULT NULL,

`sub_combination_id` int(11) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--

-- Dumping data for table `combination_courses`

--

INSERT INTO `combination_courses` (`combination_id`, `course_id`, `sub_combination_id`) VALUES


(300, 'CMPS1134', NULL),

(300, 'MATH1302', NULL),

(301, 'MATH1302', NULL);

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

--

-- Table structure for table `courses`

--

CREATE TABLE `courses` (

`course_code` varchar(30) NOT NULL,

`prog_seq_id` int(11) DEFAULT NULL,

`prerequisite_combination_id` int(11) DEFAULT NULL,

`corequisite_combination_id` int(11) DEFAULT NULL,

`course_name` varchar(30) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--

-- Dumping data for table `courses`

--

INSERT INTO `courses` (`course_code`, `prog_seq_id`, `prerequisite_combination_id`,


`corequisite_combination_id`, `course_name`) VALUES

('CMPS1134', 203, NULL, NULL, 'Fundamentals of Computing'),

('CMPS1232', 203, 300, NULL, 'Principles of Programming II'),

('CMPS2191', 203, NULL, NULL, 'Intro to Networking'),

('MATH1151', 203, NULL, NULL, 'Algebra'),

('MATH1201', 203, NULL, NULL, 'Trigonometry'),


('MATH1302', 203, NULL, NULL, 'Caculus 1'),

('MATH2201', 203, 301, NULL, 'Calculus 2'),

('SPAN101', 203, NULL, NULL, 'Spanish Lvl 1');

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

--

-- Table structure for table `course_ratings`

--

CREATE TABLE `course_ratings` (

`course_rating_id` int(11) NOT NULL,

`course_id` varchar(30) DEFAULT NULL,

`difficulty` int(11) DEFAULT NULL,

`comment` varchar(200) DEFAULT NULL,

`rating` int(11) DEFAULT NULL,

`created_at` date DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--

-- Dumping data for table `course_ratings`

--

INSERT INTO `course_ratings` (`course_rating_id`, `course_id`, `difficulty`, `comment`, `rating`,


`created_at`) VALUES

(401, 'CMPS1232', 10, 'This course is way too challenging. C++ is a very hard language', 3, '2021-05-08'),

(402, 'CMPS1232', 6, 'This course was mad difficult', 3, '2021-05-10'),

(403, 'MATH1151', 10, 'Math is my most challengin coure this semester, however the lecturer made it
easy', 10, '2021-05-08'),
(404, 'CMPS1134', 3, 'Very useful course teaches you computer essentials', 10, '2021-05-11');

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

--

-- Table structure for table `faculty`

--

CREATE TABLE `faculty` (

`faculty_id` int(11) NOT NULL,

`name` varchar(100) DEFAULT NULL,

`faculty_code` varchar(10) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--

-- Dumping data for table `faculty`

--

INSERT INTO `faculty` (`faculty_id`, `name`, `faculty_code`) VALUES

(101, 'Faculty of Science & Technology', 'FST'),

(102, 'Faculty of Education & Arts', 'FEA'),

(103, 'Faculty of Management & Social Sciences', 'FMSS');

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

--

-- Table structure for table `lecturer_courses`

--
CREATE TABLE `lecturer_courses` (

`id` int(11) NOT NULL,

`lecturer_id` int(11) DEFAULT NULL,

`course_no` varchar(15) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--

-- Dumping data for table `lecturer_courses`

--

INSERT INTO `lecturer_courses` (`id`, `lecturer_id`, `course_no`) VALUES

(1, 2020114332, 'CMPS1232');

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

--

-- Table structure for table `program_sequences`

--

CREATE TABLE `program_sequences` (

`prog_seq_id` int(11) NOT NULL,

`year` int(11) DEFAULT NULL,

`faculty_id` int(11) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--

-- Dumping data for table `program_sequences`

--
INSERT INTO `program_sequences` (`prog_seq_id`, `year`, `faculty_id`) VALUES

(200, 2020, 101),

(201, 2020, 102),

(203, 2021, 101),

(204, 2021, 103);

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

--

-- Table structure for table `registered_courses`

--

CREATE TABLE `registered_courses` (

`id` int(11) NOT NULL,

`course_id` varchar(20) DEFAULT NULL,

`student_id` int(11) DEFAULT NULL,

`semester_id` int(11) DEFAULT NULL,

`created_at` date DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--

-- Dumping data for table `registered_courses`

--

INSERT INTO `registered_courses` (`id`, `course_id`, `student_id`, `semester_id`, `created_at`) VALUES

(1, 'MATH1151', 2015112392, 500, '2021-05-09'),

(2, 'SPAN101', 2015112392, 500, '2021-05-08');

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

-- Table structure for table `semesters`

--

CREATE TABLE `semesters` (

`semester_id` int(11) NOT NULL,

`semester_name` varchar(20) DEFAULT NULL,

`year` int(11) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--

-- Dumping data for table `semesters`

--

INSERT INTO `semesters` (`semester_id`, `semester_name`, `year`) VALUES

(500, 'January Semester', 2021),

(501, 'Summer Semeseter', 2021),

(502, 'August Semester', 2021);

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

--

-- Table structure for table `student_grades`

--

CREATE TABLE `student_grades` (

`student_no` int(11) DEFAULT NULL,

`registered_course_id` int(11) DEFAULT NULL,


`created_at` date DEFAULT NULL,

`grade` int(11) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--

-- Dumping data for table `student_grades`

--

INSERT INTO `student_grades` (`student_no`, `registered_course_id`, `created_at`, `grade`) VALUES

(2015112392, 1, '2021-05-15', 100);

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

--

-- Table structure for table `users`

--

CREATE TABLE `users` (

`user_id` int(11) NOT NULL,

`first_name` varchar(30) DEFAULT NULL,

`last_name` varchar(30) DEFAULT NULL,

`email` varchar(30) DEFAULT NULL,

`DOB` varchar(10) DEFAULT NULL,

`user_role_id` int(11) DEFAULT NULL,

`prog_seq_id` int(11) DEFAULT NULL,

`password` varchar(20) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `users`

--

INSERT INTO `users` (`user_id`, `first_name`, `last_name`, `email`, `DOB`, `user_role_id`, `prog_seq_id`,
`password`) VALUES

(2015112392, 'Gilbert', 'Young', '2015112392@ub.edu.bz', '01/01/1999', 200, 203, NULL),

(2020114332, 'Farshad', 'Rabbani', '2020114332@ub.edu.bz', '01/02/1995', 300, NULL, NULL);

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

--

-- Table structure for table `user_roles`

--

CREATE TABLE `user_roles` (

`user_role_id` int(11) NOT NULL,

`role` varchar(20) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--

-- Dumping data for table `user_roles`

--

INSERT INTO `user_roles` (`user_role_id`, `role`) VALUES

(100, 'Admin'),

(200, 'Student'),

(300, 'Teacher');

--
-- Indexes for dumped tables

--

--

-- Indexes for table `combinations`

--

ALTER TABLE `combinations`

ADD PRIMARY KEY (`combination_id`);

--

-- Indexes for table `combination_courses`

--

ALTER TABLE `combination_courses`

ADD KEY `combination_id` (`combination_id`),

ADD KEY `course_id` (`course_id`),

ADD KEY `sub_combination_id` (`sub_combination_id`);

--

-- Indexes for table `courses`

--

ALTER TABLE `courses`

ADD PRIMARY KEY (`course_code`),

ADD KEY `prog_seq_id` (`prog_seq_id`),

ADD KEY `prerequisite_combination_id` (`prerequisite_combination_id`);

--

-- Indexes for table `course_ratings`

--

ALTER TABLE `course_ratings`


ADD PRIMARY KEY (`course_rating_id`),

ADD KEY `course_id` (`course_id`);

--

-- Indexes for table `faculty`

--

ALTER TABLE `faculty`

ADD PRIMARY KEY (`faculty_id`);

--

-- Indexes for table `lecturer_courses`

--

ALTER TABLE `lecturer_courses`

ADD PRIMARY KEY (`id`),

ADD KEY `lecturer_id` (`lecturer_id`),

ADD KEY `course_no` (`course_no`);

--

-- Indexes for table `program_sequences`

--

ALTER TABLE `program_sequences`

ADD PRIMARY KEY (`prog_seq_id`),

ADD KEY `faculty_id` (`faculty_id`);

--

-- Indexes for table `registered_courses`

--

ALTER TABLE `registered_courses`

ADD PRIMARY KEY (`id`),


ADD KEY `course_code` (`course_id`),

ADD KEY `user_id` (`student_id`),

ADD KEY `semester_id` (`semester_id`);

--

-- Indexes for table `semesters`

--

ALTER TABLE `semesters`

ADD PRIMARY KEY (`semester_id`);

--

-- Indexes for table `student_grades`

--

ALTER TABLE `student_grades`

ADD KEY `student_no` (`student_no`),

ADD KEY `registered_course_id` (`registered_course_id`);

--

-- Indexes for table `users`

--

ALTER TABLE `users`

ADD PRIMARY KEY (`user_id`),

ADD KEY `user_role_id` (`user_role_id`),

ADD KEY `prog_seq_id` (`prog_seq_id`);

--

-- Indexes for table `user_roles`

--

ALTER TABLE `user_roles`


ADD PRIMARY KEY (`user_role_id`);

--

-- Constraints for dumped tables

--

--

-- Constraints for table `combination_courses`

--

ALTER TABLE `combination_courses`

ADD CONSTRAINT `combination_courses_ibfk_1` FOREIGN KEY (`combination_id`) REFERENCES


`combinations` (`combination_id`),

ADD CONSTRAINT `combination_courses_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `courses`


(`course_code`),

ADD CONSTRAINT `combination_courses_ibfk_3` FOREIGN KEY (`sub_combination_id`) REFERENCES


`combinations` (`combination_id`);

--

-- Constraints for table `courses`

--

ALTER TABLE `courses`

ADD CONSTRAINT `courses_ibfk_1` FOREIGN KEY (`prog_seq_id`) REFERENCES `program_sequences`


(`prog_seq_id`),

ADD CONSTRAINT `courses_ibfk_2` FOREIGN KEY (`prerequisite_combination_id`) REFERENCES


`combinations` (`combination_id`);

--

-- Constraints for table `course_ratings`

--

ALTER TABLE `course_ratings`


ADD CONSTRAINT `course_ratings_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses`
(`course_code`);

--

-- Constraints for table `lecturer_courses`

--

ALTER TABLE `lecturer_courses`

ADD CONSTRAINT `lecturer_courses_ibfk_1` FOREIGN KEY (`lecturer_id`) REFERENCES `users`


(`user_id`),

ADD CONSTRAINT `lecturer_courses_ibfk_2` FOREIGN KEY (`course_no`) REFERENCES `courses`


(`course_code`);

--

-- Constraints for table `program_sequences`

--

ALTER TABLE `program_sequences`

ADD CONSTRAINT `program_sequences_ibfk_1` FOREIGN KEY (`faculty_id`) REFERENCES `faculty`


(`faculty_id`);

--

-- Constraints for table `registered_courses`

--

ALTER TABLE `registered_courses`

ADD CONSTRAINT `registered_courses_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses`


(`course_code`),

ADD CONSTRAINT `registered_courses_ibfk_2` FOREIGN KEY (`student_id`) REFERENCES `users`


(`user_id`),

ADD CONSTRAINT `registered_courses_ibfk_3` FOREIGN KEY (`semester_id`) REFERENCES `semesters`


(`semester_id`);

--
-- Constraints for table `student_grades`

--

ALTER TABLE `student_grades`

ADD CONSTRAINT `student_grades_ibfk_1` FOREIGN KEY (`student_no`) REFERENCES `users`


(`user_id`),

ADD CONSTRAINT `student_grades_ibfk_2` FOREIGN KEY (`registered_course_id`) REFERENCES


`registered_courses` (`id`);

--

-- Constraints for table `users`

--

ALTER TABLE `users`

ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`user_role_id`) REFERENCES `user_roles`


(`user_role_id`),

ADD CONSTRAINT `users_ibfk_2` FOREIGN KEY (`prog_seq_id`) REFERENCES `program_sequences`


(`prog_seq_id`);

/*!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 */;

You might also like