Sei sulla pagina 1di 5

-- phpMyAdmin SQL Dump

-- version 5.0.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jan 18, 2020 at 03:24 PM
-- Server version: 10.4.8-MariaDB
-- PHP Version: 7.3.11

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";


SET AUTOCOMMIT = 0;
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: `quetans`
--

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

--
-- Table structure for table `chapter`
--

CREATE TABLE `chapter` (


`id` int(11) NOT NULL,
`sub_id` int(11) NOT NULL,
`cname` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `chapter`
--

INSERT INTO `chapter` (`id`, `sub_id`, `cname`) VALUES


(1, 1, 'Chapter-1'),
(2, 1, 'Chapter-2');

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

--
-- Table structure for table `question`
--

CREATE TABLE `question` (


`id` int(11) NOT NULL,
`sub_id` int(11) NOT NULL,
`chap_id` int(11) NOT NULL,
`question` longtext NOT NULL,
`opt1` varchar(30) DEFAULT NULL,
`opt2` varchar(30) DEFAULT NULL,
`opt3` varchar(30) DEFAULT NULL,
`opt4` varchar(30) DEFAULT NULL,
`answer` longtext DEFAULT NULL,
`mark` decimal(5,0) DEFAULT NULL,
`neg_mark` decimal(5,0) DEFAULT NULL,
`true_false` varchar(5) DEFAULT NULL,
`hint` varchar(30) DEFAULT NULL,
`explanation` longtext DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `result`
--

CREATE TABLE `result` (


`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`sub_id` int(11) NOT NULL,
`exam_date_time` datetime NOT NULL,
`total_que` int(11) NOT NULL,
`attempted_que` int(11) NOT NULL,
`right_ans` int(11) NOT NULL,
`wrong_ans` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Table structure for table `subject`
--

CREATE TABLE `subject` (


`id` int(11) NOT NULL,
`cname` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `subject`
--

INSERT INTO `subject` (`id`, `cname`) VALUES


(1, 'Maths'),
(2, 'Physics'),
(3, 'Chemistry');

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

--
-- Table structure for table `users`
--

CREATE TABLE `users` (


`id` int(11) NOT NULL,
`username` varchar(40) NOT NULL,
`email` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`gender` varchar(15) NOT NULL,
`dob` date DEFAULT NULL,
`fb_id` varchar(50) DEFAULT NULL,
`google_id` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `username`, `email`, `password`, `gender`,


`dob`, `fb_id`, `google_id`) VALUES
(1, 'Test', 'test@test.com', '16d7a4fca7442dda3ad93c9a726597e4', 'male',
'2000-08-18', NULL, NULL);

--
-- Indexes for dumped tables
--

--
-- Indexes for table `chapter`
--
ALTER TABLE `chapter`
ADD PRIMARY KEY (`id`),
ADD KEY `sub_id` (`sub_id`);

--
-- Indexes for table `question`
--
ALTER TABLE `question`
ADD PRIMARY KEY (`id`),
ADD KEY `sub_id` (`sub_id`),
ADD KEY `chap_id` (`chap_id`);

--
-- Indexes for table `result`
--
ALTER TABLE `result`
ADD PRIMARY KEY (`id`),
ADD KEY `user_id` (`user_id`),
ADD KEY `sub_id` (`sub_id`);

--
-- Indexes for table `subject`
--
ALTER TABLE `subject`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

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

--
-- AUTO_INCREMENT for table `question`
--
ALTER TABLE `question`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `result`
--
ALTER TABLE `result`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `chapter`
--
ALTER TABLE `chapter`
ADD CONSTRAINT `chapter_ibfk_1` FOREIGN KEY (`sub_id`) REFERENCES
`subject` (`id`);

--
-- Constraints for table `question`
--
ALTER TABLE `question`
ADD CONSTRAINT `question_ibfk_1` FOREIGN KEY (`sub_id`) REFERENCES
`subject` (`id`),
ADD CONSTRAINT `question_ibfk_2` FOREIGN KEY (`chap_id`) REFERENCES
`chapter` (`id`);
--
-- Constraints for table `result`
--
ALTER TABLE `result`
ADD CONSTRAINT `result_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES
`users` (`id`),
ADD CONSTRAINT `result_ibfk_2` FOREIGN KEY (`sub_id`) REFERENCES
`subject` (`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 */;

Potrebbero piacerti anche