0% found this document useful (0 votes)
14 views

DB Structure

The document is a SQL dump generated by phpMyAdmin for a database named 'test_portal', containing various table structures and data inserts for managing assignments, courses, exams, and notifications. It includes definitions for tables such as 'assignment_status', 'course', 'exam', and their respective data entries. The SQL dump is compatible with MariaDB and uses UTF-8 character encoding.

Uploaded by

menghongwork
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

DB Structure

The document is a SQL dump generated by phpMyAdmin for a database named 'test_portal', containing various table structures and data inserts for managing assignments, courses, exams, and notifications. It includes definitions for tables such as 'assignment_status', 'course', 'exam', and their respective data entries. The SQL dump is compatible with MariaDB and uses UTF-8 character encoding.

Uploaded by

menghongwork
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 14

-- phpMyAdmin SQL Dump

-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Feb 23, 2024 at 01:08 PM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.2.12

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

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

--
-- Table structure for table `assignment_status`
--

CREATE TABLE `assignment_status` (


`status_id` int(11) NOT NULL,
`value` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

--
-- Dumping data for table `assignment_status`
--

INSERT INTO `assignment_status` (`status_id`, `value`) VALUES


(1, 'Awaiting approval'),
(2, 'Declined'),
(6, 'Graded'),
(4, 'In progress'),
(3, 'Ready'),
(5, 'Turned in');

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

--
-- Table structure for table `course`
--

CREATE TABLE `course` (


`course_code` varchar(8) NOT NULL,
`course_name` varchar(256) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

--
-- Dumping data for table `course`
--

INSERT INTO `course` (`course_code`, `course_name`) VALUES


('CSC307', 'Computer Architecture and Organization'),
('GST301', 'Entrepreneurial Studies II'),
('CSC334', 'Numerical Analysis'),
('CSC303', 'Object Oriented Programming'),
('CSC305', 'Operating Systems II'),
('CSC309', 'Sytem Analysis and Design'),
('CSC313', 'Web Programming');

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

--
-- Table structure for table `exam`
--

CREATE TABLE `exam` (


`exam_id` int(11) NOT NULL,
`instructor_id` varchar(16) NOT NULL,
`course_code` varchar(8) NOT NULL,
`title` varchar(45) NOT NULL,
`type_id` int(11) NOT NULL,
`no_of_questions` int(11) NOT NULL,
`status_id` int(11) NOT NULL DEFAULT 1,
`invite_prefix` varchar(5) NOT NULL,
`total_mark` float NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

--
-- Dumping data for table `exam`
--

INSERT INTO `exam` (`exam_id`, `instructor_id`, `course_code`, `title`, `type_id`,


`no_of_questions`, `status_id`, `invite_prefix`, `total_mark`) VALUES
(1, 'admin', 'CSC307', 'JULIU', 4, 1, 2, 'QFf1D', 33),
(2, 'admin', 'CSC307', 'dsfdsf', 1, 1, 2, 'trJ0k', 34),
(3, 'admin', 'CSC307', 'dfgsdfg', 2, 1, 2, 'JM0z3', 44),
(4, 'admin', 'CSC307', 'Final exam', 4, 1, 2, 'cs1ad', 22),
(5, 'admin', 'CSC307', 'sdfg', 5, 1, 2, 'YQ6eZ', 11),
(6, 'admin', 'CSC307', 'wrs', 5, 1, 2, 'd7oGO', 445),
(7, 'admin', 'CSC307', 'fdsfdsf', 5, 1, 2, '0ALA6', 33),
(8, 'admin', 'CSC307', 'fdgh', 5, 1, 2, '4TaDO', 4353),
(9, 'admin', 'CSC307', 'sedfrhgysedrfrh', 5, 1, 2, 'ZyPjr', 6776),
(10, 'admin', 'CSC307', 'fdsgs', 5, 1, 2, 'oJ8gN', 546),
(11, 'admin', 'CSC307', 'FINAL EXAM EASY', 4, 1, 2, 'L4Nph', 3242),
(12, 'admin1', 'CSC334', 'mid term', 4, 1, 1, 'dblbN', 5),
(13, 'admin', 'CSC307', 'HHHH', 4, 1, 2, 'QAhuP', 24),
(14, 'admin', 'CSC307', 'dfgsfdgsdf', 5, 1, 1, '1rT14', 3),
(15, 'admin', 'CSC307', 'Final exam', 5, 1, 1, 'eoitd', 44);

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

--
-- Table structure for table `exam_assignment`
--

CREATE TABLE `exam_assignment` (


`exam_id` int(11) NOT NULL,
`assignee_id` varchar(16) NOT NULL,
`total_score` float DEFAULT NULL,
`status_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

--
-- Dumping data for table `exam_assignment`
--

INSERT INTO `exam_assignment` (`exam_id`, `assignee_id`, `total_score`,


`status_id`) VALUES
(1, 'admin1', 22, 6),
(2, 'admin1', 34, 6),
(3, 'admin1', 44, 6),
(4, 'admin1', NULL, 2),
(11, 'admin1', NULL, 3),
(12, 'admin', 5, 6),
(13, 'admin1', NULL, 3);

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

--
-- Table structure for table `exam_status`
--

CREATE TABLE `exam_status` (


`status_id` int(11) NOT NULL,
`value` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

--
-- Dumping data for table `exam_status`
--

INSERT INTO `exam_status` (`status_id`, `value`) VALUES


(2, 'Closed'),
(1, 'Open');

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

--
-- Table structure for table `exam_type`
--

CREATE TABLE `exam_type` (


`type_id` int(11) NOT NULL,
`value` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

--
-- Dumping data for table `exam_type`
--

INSERT INTO `exam_type` (`type_id`, `value`) VALUES


(2, 'Fill in the blank'),
(1, 'Multi-choice'),
(5, 'Multi-choice Image'),
(3, 'Theory'),
(4, 'Three Multi-choice');
-- --------------------------------------------------------

--
-- Table structure for table `fill_in_question`
--

CREATE TABLE `fill_in_question` (


`exam_id` int(11) NOT NULL,
`question_no` int(11) NOT NULL,
`question` varchar(256) NOT NULL,
`mark` float NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

--
-- Dumping data for table `fill_in_question`
--

INSERT INTO `fill_in_question` (`exam_id`, `question_no`, `question`, `mark`)


VALUES
(3, 1, 'fdgsdf', 44);

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

--
-- Table structure for table `fill_in_response`
--

CREATE TABLE `fill_in_response` (


`exam_id` int(11) NOT NULL,
`question_no` int(11) NOT NULL,
`assignee_id` varchar(16) NOT NULL,
`response` varchar(45) DEFAULT NULL,
`score` float DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

--
-- Dumping data for table `fill_in_response`
--

INSERT INTO `fill_in_response` (`exam_id`, `question_no`, `assignee_id`,


`response`, `score`) VALUES
(3, 1, 'admin1', NULL, 44);

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

--
-- Table structure for table `level`
--

CREATE TABLE `level` (


`level_id` int(11) NOT NULL,
`value` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

--
-- Dumping data for table `level`
--
INSERT INTO `level` (`level_id`, `value`) VALUES
(1, '100'),
(2, '200'),
(3, '300'),
(4, '400'),
(5, '500');

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

--
-- Table structure for table `multi_choice_question`
--

CREATE TABLE `multi_choice_question` (


`exam_id` int(11) NOT NULL,
`question_no` int(11) NOT NULL,
`question` varchar(256) NOT NULL,
`correct_answer` varchar(1) NOT NULL,
`a` varchar(256) NOT NULL,
`b` varchar(256) NOT NULL,
`c` varchar(256) NOT NULL,
`d` varchar(256) NOT NULL,
`mark` float NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

--
-- Dumping data for table `multi_choice_question`
--

INSERT INTO `multi_choice_question` (`exam_id`, `question_no`, `question`,


`correct_answer`, `a`, `b`, `c`, `d`, `mark`) VALUES
(2, 1, 'asdf', 'C', 'dasfadsfasd', 'fsdf', 'asdfsad', 'sdfa', 34);

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

--
-- Table structure for table `multi_choice_response`
--

CREATE TABLE `multi_choice_response` (


`exam_id` int(11) NOT NULL,
`question_no` int(11) NOT NULL,
`assignee_id` varchar(16) NOT NULL,
`response` varchar(1) DEFAULT NULL,
`score` float DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

--
-- Dumping data for table `multi_choice_response`
--

INSERT INTO `multi_choice_response` (`exam_id`, `question_no`, `assignee_id`,


`response`, `score`) VALUES
(2, 1, 'admin1', 'C', 34);

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

--
-- Table structure for table `multi_img_choice_question`
--

CREATE TABLE `multi_img_choice_question` (


`exam_id` int(11) NOT NULL,
`question_no` int(11) NOT NULL,
`question` varchar(256) NOT NULL,
`a` varchar(256) NOT NULL,
`b` varchar(256) NOT NULL,
`c` varchar(256) NOT NULL,
`mark` float NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `multi_img_choice_question`
--

INSERT INTO `multi_img_choice_question` (`exam_id`, `question_no`, `question`, `a`,


`b`, `c`, `mark`) VALUES
(5, 1, 'What is the PIC???', '', '', '', 11),
(6, 1, 'sd', '', '', '', 445),
(7, 1, 'fghdfgfg', '', '', '', 33),
(8, 1, 'fghnbfgj', '', '', '', 4353),
(9, 1, 'sdfghdfh', '', '', '', 6776),
(10, 1, 'fdsgsdfzg', '', '', '', 546),
(14, 1, 'sdfasdf', '', '', '', 3),
(15, 1, 'ewtg', '', '', '', 44);

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

--
-- Table structure for table `notification`
--

CREATE TABLE `notification` (


`notification_id` int(10) UNSIGNED NOT NULL,
`recipient_id` varchar(16) NOT NULL,
`status_id` int(11) UNSIGNED NOT NULL DEFAULT 1,
`type_id` int(11) UNSIGNED NOT NULL,
`sender_id` varchar(16) NOT NULL,
`exam_id` int(11) NOT NULL,
`time_stamp` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

--
-- Dumping data for table `notification`
--

INSERT INTO `notification` (`notification_id`, `recipient_id`, `status_id`,


`type_id`, `sender_id`, `exam_id`, `time_stamp`) VALUES
(27, 'admin1', 2, 2, 'admin', 12, '2024-02-23 11:16:11'),
(28, 'admin1', 2, 5, 'admin', 12, '2024-02-23 11:16:18'),
(29, 'admin', 2, 2, 'admin1', 13, '2024-02-23 11:16:18'),
(30, 'admin1', 1, 6, 'admin', 12, '2024-02-23 11:16:22'),
(31, 'admin', 2, 7, 'admin1', 12, '2024-02-23 11:17:32');

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

--
-- Table structure for table `notification_status`
--

CREATE TABLE `notification_status` (


`status_id` int(10) UNSIGNED NOT NULL,
`value` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

--
-- Dumping data for table `notification_status`
--

INSERT INTO `notification_status` (`status_id`, `value`) VALUES


(1, 'Unviewed'),
(2, 'Viewed');

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

--
-- Table structure for table `notification_type`
--

CREATE TABLE `notification_type` (


`type_id` int(10) UNSIGNED NOT NULL,
`value` varchar(45) NOT NULL,
`msg_template` varchar(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

--
-- Dumping data for table `notification_type`
--

INSERT INTO `notification_type` (`type_id`, `value`, `msg_template`) VALUES


(1, 'Invite', '[User] has invited you to take [Exam]'),
(2, 'Accepted invite', '[User] has accepted your invite to take [Exam]'),
(3, 'Declined invite', '[User] has declined your invite to take [Exam]'),
(4, 'Joined by code', '[User] has joined [Exam] by invite code'),
(5, 'Started exam', '[User] has started [Exam]'),
(6, 'Completed exam', '[User] has completed [Exam]'),
(7, 'Graded exam', '[User] has graded [Exam]'),
(8, 'Closed exam', '[User] has closed [Exam]');

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

--
-- Table structure for table `theory_question`
--

CREATE TABLE `theory_question` (


`exam_id` int(11) NOT NULL,
`question_no` int(11) NOT NULL,
`question` varchar(256) NOT NULL,
`mark` float NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

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

--
-- Table structure for table `theory_response`
--
CREATE TABLE `theory_response` (
`exam_id` int(11) NOT NULL,
`question_no` int(11) NOT NULL,
`assignee_id` varchar(16) NOT NULL,
`response` varchar(256) DEFAULT NULL,
`score` float DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

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

--
-- Table structure for table `three_multi_choice_question`
--

CREATE TABLE `three_multi_choice_question` (


`exam_id` int(11) NOT NULL,
`question_no` int(11) NOT NULL,
`question` varchar(256) NOT NULL,
`a` varchar(256) NOT NULL,
`b` varchar(256) NOT NULL,
`c` varchar(256) NOT NULL,
`mark` float NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `three_multi_choice_question`
--

INSERT INTO `three_multi_choice_question` (`exam_id`, `question_no`, `question`,


`a`, `b`, `c`, `mark`) VALUES
(1, 1, 'IFbidsgdfh', 'fdhdsf', 'dsfhsd', 'dsfhdfs', 33),
(4, 1, 'df', 'sdfsdf', 'sdf', 'sdfsd', 22),
(11, 1, 'WHO ARE YOU??', 'HUMAN', 'BIRD', 'ALIEN', 3242),
(12, 1, 'asdad', 'asdsad', 'adsa', 'asd', 5),
(13, 1, 'HHHHH', 'OPTION HEHEH!', 'IOTOJIDIK 22', 'dfhok34 3', 24);

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

--
-- Table structure for table `three_multi_choice_response`
--

CREATE TABLE `three_multi_choice_response` (


`exam_id` int(11) NOT NULL,
`question_no` int(11) NOT NULL,
`assignee_id` varchar(16) NOT NULL,
`response` varchar(1) DEFAULT NULL,
`score` float DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `three_multi_choice_response`
--

INSERT INTO `three_multi_choice_response` (`exam_id`, `question_no`, `assignee_id`,


`response`, `score`) VALUES
(1, 1, 'admin1', 'B', 22),
(12, 1, 'admin', 'B', 5);
-- --------------------------------------------------------

--
-- Table structure for table `user`
--

CREATE TABLE `user` (


`user_id` varchar(16) NOT NULL,
`first_name` varchar(45) NOT NULL,
`last_name` varchar(45) NOT NULL,
`email` varchar(45) NOT NULL,
`password` varchar(45) NOT NULL,
`level_id` int(11) DEFAULT NULL,
`profile_picture` varchar(45) DEFAULT NULL,
`recovery_key` varchar(8) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

--
-- Dumping data for table `user`
--

INSERT INTO `user` (`user_id`, `first_name`, `last_name`, `email`, `password`,


`level_id`, `profile_picture`, `recovery_key`) VALUES
('admin', 'Ravi', 'Kushwaha', '[email protected]',
'25d55ad283aa400af464c76d713c07ad', 3, NULL, NULL),
('admin1', 'Developer', 'KK', '[email protected]',
'25d55ad283aa400af464c76d713c07ad', NULL, NULL, NULL);

--
-- Indexes for dumped tables
--

--
-- Indexes for table `assignment_status`
--
ALTER TABLE `assignment_status`
ADD PRIMARY KEY (`status_id`),
ADD UNIQUE KEY `assignment_status_value_UNIQUE` (`value`);

--
-- Indexes for table `course`
--
ALTER TABLE `course`
ADD PRIMARY KEY (`course_code`),
ADD UNIQUE KEY `course_name_UNIQUE` (`course_name`);

--
-- Indexes for table `exam`
--
ALTER TABLE `exam`
ADD PRIMARY KEY (`exam_id`),
ADD KEY `exam_course_code_idx` (`course_code`),
ADD KEY `exam_type_id_idx` (`type_id`),
ADD KEY `exam_instructor_id_idx` (`instructor_id`),
ADD KEY `exam_status_id` (`status_id`);

--
-- Indexes for table `exam_assignment`
--
ALTER TABLE `exam_assignment`
ADD PRIMARY KEY (`exam_id`,`assignee_id`),
ADD KEY `assignment_assignee_id_idx` (`assignee_id`),
ADD KEY `assignment_status_id_idx` (`status_id`);

--
-- Indexes for table `exam_status`
--
ALTER TABLE `exam_status`
ADD PRIMARY KEY (`status_id`),
ADD UNIQUE KEY `exam_status_value_UNIQUE` (`value`);

--
-- Indexes for table `exam_type`
--
ALTER TABLE `exam_type`
ADD PRIMARY KEY (`type_id`),
ADD UNIQUE KEY `exam_type_value_UNIQUE` (`value`);

--
-- Indexes for table `fill_in_question`
--
ALTER TABLE `fill_in_question`
ADD PRIMARY KEY (`exam_id`,`question_no`);

--
-- Indexes for table `fill_in_response`
--
ALTER TABLE `fill_in_response`
ADD PRIMARY KEY (`exam_id`,`question_no`,`assignee_id`),
ADD KEY `fill_in_response_assignee_id_idx` (`assignee_id`);

--
-- Indexes for table `level`
--
ALTER TABLE `level`
ADD PRIMARY KEY (`level_id`),
ADD UNIQUE KEY `level_value_UNIQUE` (`value`);

--
-- Indexes for table `multi_choice_question`
--
ALTER TABLE `multi_choice_question`
ADD PRIMARY KEY (`exam_id`,`question_no`);

--
-- Indexes for table `multi_choice_response`
--
ALTER TABLE `multi_choice_response`
ADD PRIMARY KEY (`exam_id`,`question_no`,`assignee_id`),
ADD KEY `multi_choice_response_assignee_id_idx` (`assignee_id`);

--
-- Indexes for table `multi_img_choice_question`
--
ALTER TABLE `multi_img_choice_question`
ADD PRIMARY KEY (`exam_id`,`question_no`);
--
-- Indexes for table `notification`
--
ALTER TABLE `notification`
ADD PRIMARY KEY (`notification_id`),
ADD KEY `notification_status_id` (`status_id`),
ADD KEY `notification_sender_id` (`sender_id`),
ADD KEY `notification_type_id` (`type_id`),
ADD KEY `notification_recipient_id` (`recipient_id`),
ADD KEY `exam_id` (`exam_id`);

--
-- Indexes for table `notification_status`
--
ALTER TABLE `notification_status`
ADD PRIMARY KEY (`status_id`);

--
-- Indexes for table `notification_type`
--
ALTER TABLE `notification_type`
ADD PRIMARY KEY (`type_id`),
ADD UNIQUE KEY `msg_template_UNIQUE` (`msg_template`);

--
-- Indexes for table `theory_question`
--
ALTER TABLE `theory_question`
ADD PRIMARY KEY (`exam_id`,`question_no`);

--
-- Indexes for table `theory_response`
--
ALTER TABLE `theory_response`
ADD PRIMARY KEY (`exam_id`,`question_no`,`assignee_id`),
ADD KEY `theory_response_assignee_id_idx` (`assignee_id`);

--
-- Indexes for table `three_multi_choice_question`
--
ALTER TABLE `three_multi_choice_question`
ADD PRIMARY KEY (`exam_id`,`question_no`);

--
-- Indexes for table `three_multi_choice_response`
--
ALTER TABLE `three_multi_choice_response`
ADD PRIMARY KEY (`exam_id`,`question_no`,`assignee_id`);

--
-- Indexes for table `user`
--
ALTER TABLE `user`
ADD PRIMARY KEY (`user_id`),
ADD UNIQUE KEY `email_UNIQUE` (`email`) USING BTREE,
ADD KEY `user_level_id_idx` (`level_id`);

--
-- AUTO_INCREMENT for dumped tables
--

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

--
-- AUTO_INCREMENT for table `exam`
--
ALTER TABLE `exam`
MODIFY `exam_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

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

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

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

--
-- AUTO_INCREMENT for table `notification`
--
ALTER TABLE `notification`
MODIFY `notification_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
AUTO_INCREMENT=32;

--
-- AUTO_INCREMENT for table `notification_status`
--
ALTER TABLE `notification_status`
MODIFY `status_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `notification_type`
--
ALTER TABLE `notification_type`
MODIFY `type_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `exam`
--
ALTER TABLE `exam`
ADD CONSTRAINT `exam_course_code` FOREIGN KEY (`course_code`) REFERENCES `course`
(`course_code`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `exam_instructor_id` FOREIGN KEY (`instructor_id`) REFERENCES
`user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `exam_status_id` FOREIGN KEY (`status_id`) REFERENCES
`exam_status` (`status_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `exam_type_id` FOREIGN KEY (`type_id`) REFERENCES `exam_type`
(`type_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `exam_assignment`
--
ALTER TABLE `exam_assignment`
ADD CONSTRAINT `assignment_assignee_id` FOREIGN KEY (`assignee_id`) REFERENCES
`user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `assignment_exam_id` FOREIGN KEY (`exam_id`) REFERENCES `exam`
(`exam_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `assignment_status_id` FOREIGN KEY (`status_id`) REFERENCES
`assignment_status` (`status_id`) ON UPDATE CASCADE;

--
-- Constraints for table `fill_in_question`
--
ALTER TABLE `fill_in_question`
ADD CONSTRAINT `fill_in_question_exam_id` FOREIGN KEY (`exam_id`) REFERENCES
`exam` (`exam_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `fill_in_response`
--
ALTER TABLE `fill_in_response`
ADD CONSTRAINT `fill_in_response_assignee_id` FOREIGN KEY (`assignee_id`)
REFERENCES `user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `fill_in_response_id` FOREIGN KEY (`exam_id`,`question_no`)
REFERENCES `fill_in_question` (`exam_id`, `question_no`) ON DELETE CASCADE;

--
-- Constraints for table `multi_choice_question`
--
ALTER TABLE `multi_choice_question`
ADD CONSTRAINT `multi_choice_question_exam_id` FOREIGN KEY (`exam_id`) REFERENCES
`exam` (`exam_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `multi_choice_response`
--
ALTER TABLE `multi_choice_response`
ADD CONSTRAINT `multi_choice_response_assignee_id` FOREIGN KEY (`assignee_id`)
REFERENCES `user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `multi_choice_response_id` FOREIGN KEY (`exam_id`,`question_no`)
REFERENCES `multi_choice_question` (`exam_id`, `question_no`) ON DELETE CASCADE;

--
-- Constraints for table `notification`
--
ALTER TABLE `notification`
ADD CONSTRAINT `notification_ibfk_1` FOREIGN KEY (`exam_id`) REFERENCES `exam`
(`exam_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `notification_recipient_id` FOREIGN KEY (`recipient_id`)
REFERENCES `user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `notification_sender_id` FOREIGN KEY (`sender_id`) REFERENCES
`user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `notification_status_id` FOREIGN KEY (`status_id`) REFERENCES
`notification_status` (`status_id`),
ADD CONSTRAINT `notification_type_id` FOREIGN KEY (`type_id`) REFERENCES
`notification_type` (`type_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `theory_question`
--
ALTER TABLE `theory_question`
ADD CONSTRAINT `theory_question_exam_id` FOREIGN KEY (`exam_id`) REFERENCES
`exam` (`exam_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `theory_response`
--
ALTER TABLE `theory_response`
ADD CONSTRAINT `theory_response_assignee_id` FOREIGN KEY (`assignee_id`)
REFERENCES `user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `theory_response_id` FOREIGN KEY (`exam_id`,`question_no`)
REFERENCES `theory_question` (`exam_id`, `question_no`) ON DELETE CASCADE;

--
-- Constraints for table `three_multi_choice_question`
--
ALTER TABLE `three_multi_choice_question`
ADD CONSTRAINT `three_multi_choice_question_exam_id` FOREIGN KEY (`exam_id`)
REFERENCES `exam` (`exam_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `three_multi_choice_response`
--
ALTER TABLE `three_multi_choice_response`
ADD CONSTRAINT `three_multi_choice_response_id` FOREIGN KEY
(`exam_id`,`question_no`) REFERENCES `three_multi_choice_question` (`exam_id`,
`question_no`) ON DELETE CASCADE;

--
-- Constraints for table `user`
--
ALTER TABLE `user`
ADD CONSTRAINT `user_level_id` FOREIGN KEY (`level_id`) REFERENCES `level`
(`level_id`) ON DELETE CASCADE ON UPDATE SET NULL;
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 */;

You might also like