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

-- PhpMyAdmin SQL Dump

The document is a SQL dump for a database named 'onlineexamportal', created using phpMyAdmin version 5.2.1. It includes the structure and data for several tables such as 'examiners', 'exams', 'exam_attempts', 'exam_retake_requests', 'questions', 'results', 'students', and 'student_exam_access', along with their respective indexes and constraints. The dump also sets up the necessary SQL modes and transaction settings for the database environment.

Uploaded by

panditpuspa000
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)
7 views

-- PhpMyAdmin SQL Dump

The document is a SQL dump for a database named 'onlineexamportal', created using phpMyAdmin version 5.2.1. It includes the structure and data for several tables such as 'examiners', 'exams', 'exam_attempts', 'exam_retake_requests', 'questions', 'results', 'students', and 'student_exam_access', along with their respective indexes and constraints. The dump also sets up the necessary SQL modes and transaction settings for the database environment.

Uploaded by

panditpuspa000
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/ 6

-- phpMyAdmin SQL Dump

-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 25, 2025 at 07:01 AM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.0.30

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

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

--
-- Table structure for table `examiners`
--

CREATE TABLE `examiners` (


`E_id` int(11) NOT NULL,
`username` varchar(50) DEFAULT NULL,
`password` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `examiners`
--

INSERT INTO `examiners` (`E_id`, `username`, `password`) VALUES


(1, 'aa', 'aa');

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

--
-- Table structure for table `exams`
--

CREATE TABLE `exams` (


`exam_id` int(11) NOT NULL,
`title` varchar(100) NOT NULL,
`duration` int(11) NOT NULL,
`is_enabled` tinyint(1) DEFAULT 1,
`start_date` date DEFAULT NULL,
`start_time` time DEFAULT NULL,
`status` varchar(10) DEFAULT 'enabled',
`shuffle_questions` tinyint(1) DEFAULT 0,
`question_limit` int(11) DEFAULT NULL,
`max_attempts` int(11) DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `exams`
--

INSERT INTO `exams` (`exam_id`, `title`, `duration`, `is_enabled`, `start_date`,


`start_time`, `status`, `shuffle_questions`, `question_limit`, `max_attempts`)
VALUES
(1, 'Exam', 40, 1, '0023-11-24', '02:54:00', 'enabled', 0, NULL, 2),
(2, 'math', 20, 1, '0023-11-24', '02:54:00', 'enabled', 0, 2, 2);

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

--
-- Table structure for table `exam_attempts`
--

CREATE TABLE `exam_attempts` (


`ex_id` int(11) NOT NULL,
`student_id` int(11) DEFAULT NULL,
`exam_id` int(11) DEFAULT NULL,
`start_time` datetime DEFAULT NULL,
`last_activity` datetime DEFAULT NULL,
`is_completed` tinyint(1) DEFAULT 0,
`end_time` datetime DEFAULT NULL,
`score` int(11) DEFAULT NULL,
`total_possible_marks` int(11) DEFAULT NULL,
`is_published` tinyint(1) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `exam_attempts`
--

--
-- Table structure for table `exam_retake_requests`
--

CREATE TABLE `exam_retake_requests` (


`request_id` int(11) NOT NULL,
`student_id` int(11) NOT NULL,
`exam_id` int(11) NOT NULL,
`request_date` datetime DEFAULT current_timestamp(),
`status` varchar(20) DEFAULT 'Pending',
`examiner_notes` text DEFAULT NULL,
`reason` text DEFAULT NULL,
`response_date` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `exam_retake_requests`
--

--
-- Table structure for table `questions`
--
CREATE TABLE `questions` (
`question_id` int(11) NOT NULL,
`exam_id` int(11) NOT NULL,
`question_text` text NOT NULL,
`option_a` varchar(255) NOT NULL,
`option_b` varchar(255) NOT NULL,
`option_c` varchar(255) NOT NULL,
`option_d` varchar(255) NOT NULL,
`correct_answer` char(1) NOT NULL,
`marks` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `questions`
--

-- --------------------------------------------------------
--
-- Table structure for table `results`
--

CREATE TABLE `results` (


`r_id` int(11) NOT NULL,
`student_name` varchar(100) DEFAULT NULL,
`exam_id` int(11) DEFAULT NULL,
`exam_title` varchar(100) DEFAULT NULL,
`question_id` int(11) DEFAULT NULL,
`selected_answer` varchar(5) DEFAULT NULL,
`correct_answer` varchar(5) DEFAULT NULL,
`marks_awarded` int(11) DEFAULT NULL,
`attempt_time` datetime DEFAULT current_timestamp(),
`student_id` int(11) DEFAULT NULL,
`attempt_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `results`
--

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

--
-- Table structure for table `students`
--

CREATE TABLE `students` (


`student_id` int(11) NOT NULL,
`name` varchar(100) DEFAULT NULL,
`username` varchar(50) DEFAULT NULL,
`email` varchar(100) DEFAULT NULL,
`password` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `students`
--

INSERT INTO `students` (`student_id`, `name`, `username`, `email`, `password`)


VALUES
(12, 'Puspa Pandit', 'panditpuspa', '[email protected]', '123456'),
(15, 'Kamal Dauliya', 'Kamal', '[email protected]', '123456789'),
(16, 'Anish Thapa', 'anish', '[email protected]', 'anishh');

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

--
-- Table structure for table `student_exam_access`
--

CREATE TABLE `student_exam_access` (


`student_id` int(11) NOT NULL,
`exam_id` int(11) NOT NULL,
`is_allowed` tinyint(1) DEFAULT 0,
`shuffle_questions` tinyint(1) DEFAULT 0,
`question_limit` int(11) DEFAULT 5,
`attempts_taken` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--

--
-- Indexes for dumped tables
--

--
-- Indexes for table `examiners`
--
ALTER TABLE `examiners`
ADD PRIMARY KEY (`E_id`),
ADD UNIQUE KEY `username` (`username`);

--
-- Indexes for table `exams`
--
ALTER TABLE `exams`
ADD PRIMARY KEY (`exam_id`);

--
-- Indexes for table `exam_attempts`
--
ALTER TABLE `exam_attempts`
ADD PRIMARY KEY (`ex_id`),
ADD KEY `fk_exam_attempts_student` (`student_id`),
ADD KEY `fk_exam_attempts_exam` (`exam_id`);

--
-- Indexes for table `exam_retake_requests`
--
ALTER TABLE `exam_retake_requests`
ADD PRIMARY KEY (`request_id`),
ADD UNIQUE KEY `student_id` (`student_id`,`exam_id`),
ADD KEY `exam_id` (`exam_id`);

--
-- Indexes for table `questions`
--
ALTER TABLE `questions`
ADD PRIMARY KEY (`question_id`),
ADD KEY `exam_id` (`exam_id`);

--
-- Indexes for table `results`
--
ALTER TABLE `results`
ADD PRIMARY KEY (`r_id`),
ADD UNIQUE KEY `attempt_id` (`attempt_id`,`question_id`),
ADD KEY `exam_id` (`exam_id`),
ADD KEY `question_id` (`question_id`);

--
-- Indexes for table `students`
--
ALTER TABLE `students`
ADD PRIMARY KEY (`student_id`),
ADD UNIQUE KEY `username` (`username`);

--
-- Indexes for table `student_exam_access`
--
ALTER TABLE `student_exam_access`
ADD PRIMARY KEY (`student_id`,`exam_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `examiners`
--
ALTER TABLE `examiners`
MODIFY `E_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

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

--
-- AUTO_INCREMENT for table `exam_attempts`
--
ALTER TABLE `exam_attempts`
MODIFY `ex_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=36;

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

--
-- AUTO_INCREMENT for table `questions`
--
ALTER TABLE `questions`
MODIFY `question_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `results`
--
ALTER TABLE `results`
MODIFY `r_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=42;

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `exam_attempts`
--
ALTER TABLE `exam_attempts`
ADD CONSTRAINT `fk_exam_attempts_exam` FOREIGN KEY (`exam_id`) REFERENCES `exams`
(`exam_id`) ON DELETE CASCADE,
ADD CONSTRAINT `fk_exam_attempts_student` FOREIGN KEY (`student_id`) REFERENCES
`students` (`student_id`) ON DELETE CASCADE;

--
-- Constraints for table `exam_retake_requests`
--
ALTER TABLE `exam_retake_requests`
ADD CONSTRAINT `exam_retake_requests_ibfk_1` FOREIGN KEY (`student_id`)
REFERENCES `students` (`student_id`),
ADD CONSTRAINT `exam_retake_requests_ibfk_2` FOREIGN KEY (`exam_id`) REFERENCES
`exams` (`exam_id`);

--
-- Constraints for table `questions`
--
ALTER TABLE `questions`
ADD CONSTRAINT `questions_ibfk_1` FOREIGN KEY (`exam_id`) REFERENCES `exams`
(`exam_id`) ON DELETE CASCADE;

--
-- Constraints for table `results`
--
ALTER TABLE `results`
ADD CONSTRAINT `fk_results_exam_attempts` FOREIGN KEY (`attempt_id`) REFERENCES
`exam_attempts` (`ex_id`) ON DELETE CASCADE,
ADD CONSTRAINT `results_ibfk_1` FOREIGN KEY (`exam_id`) REFERENCES `exams`
(`exam_id`),
ADD CONSTRAINT `results_ibfk_2` FOREIGN KEY (`question_id`) REFERENCES
`questions` (`question_id`);
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