-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase.sql
127 lines (103 loc) · 3.64 KB
/
database.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1:3306
-- Generation Time: Dec 17, 2020 at 04:27 AM
-- Server version: 5.7.26
-- PHP Version: 7.2.18
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: `axexamplus`
--
-- --------------------------------------------------------
--
-- Table structure for table `tbl_answers`
--
DROP TABLE IF EXISTS `tbl_answers`;
CREATE TABLE IF NOT EXISTS `tbl_answers` (
`question_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`opt` int(11) NOT NULL,
PRIMARY KEY (`question_id`,`user_id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `tbl_answers_temp`
--
DROP TABLE IF EXISTS `tbl_answers_temp`;
CREATE TABLE IF NOT EXISTS `tbl_answers_temp` (
`question_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`opt` int(11) NOT NULL,
PRIMARY KEY (`question_id`,`user_id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `tbl_exams`
--
DROP TABLE IF EXISTS `tbl_exams`;
CREATE TABLE IF NOT EXISTS `tbl_exams` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `tbl_exams_questions`
--
DROP TABLE IF EXISTS `tbl_exams_questions`;
CREATE TABLE IF NOT EXISTS `tbl_exams_questions` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`exam_id` int(10) DEFAULT NULL,
`question_number` int(5) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `exam_id` (`exam_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `tbl_users`
--
DROP TABLE IF EXISTS `tbl_users`;
CREATE TABLE IF NOT EXISTS `tbl_users` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`username` varchar(50) DEFAULT NULL,
`password` text,
`token` text,
`suspend` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `tbl_answers`
--
ALTER TABLE `tbl_answers`
ADD CONSTRAINT `tbl_answers_ibfk_1` FOREIGN KEY (`question_id`) REFERENCES `tbl_exams_questions` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
ADD CONSTRAINT `tbl_answers_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `tbl_users` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION;
--
-- Constraints for table `tbl_answers_temp`
--
ALTER TABLE `tbl_answers_temp`
ADD CONSTRAINT `tbl_answers_temp_ibfk_1` FOREIGN KEY (`question_id`) REFERENCES `tbl_exams_questions` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
ADD CONSTRAINT `tbl_answers_temp_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `tbl_users` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION;
--
-- Constraints for table `tbl_exams_questions`
--
ALTER TABLE `tbl_exams_questions`
ADD CONSTRAINT `tbl_exams_questions_ibfk_1` FOREIGN KEY (`exam_id`) REFERENCES `tbl_exams` (`id`) ON DELETE CASCADE 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 */;