secret
Created

Database for a Chemistry Quiz using cxsmiles as structures

  • Download Gist
Chemistry database
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 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
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 utf8 */;
 
--
-- ChemistryQuiz database
--
 
-- --------------------------------------------------------
 
--
-- structure `category` table
--
 
CREATE TABLE IF NOT EXISTS `category` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`unit_id` int(10) unsigned NOT NULL,
`texto` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
KEY `unit_id` (`unit_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
 
-- --------------------------------------------------------
 
--
-- structure `questionTxt` table
--
 
CREATE TABLE IF NOT EXISTS `questionTxt` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`texto` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
 
-- --------------------------------------------------------
 
--
-- structure of `structure` table
--
 
CREATE TABLE IF NOT EXISTS `structure` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`cxsmiles` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`isAnswer` tinyint(4) NOT NULL,
`isQuestion` tinyint(4) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
 
--
-- structure `oneStructureQuestion` table
--
 
CREATE TABLE IF NOT EXISTS `oneStructureQuestion` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`structure_id` int(10) unsigned NOT NULL,
`questionTxt_id` int(10) unsigned NOT NULL,
`question_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `structure_id` (`structure_id`),
KEY `questionTxt_id` (`questionTxt_id`),
KEY `question_id` (`question_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
 
-- --------------------------------------------------------
 
--
-- structure `questions` table
--
 
CREATE TABLE IF NOT EXISTS `questions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`QuestionType` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`category_id` int(10) unsigned NOT NULL,
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `QuestionType` (`QuestionType`),
KEY `category_id` (`category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
 
-- --------------------------------------------------------
 
--
-- structure `subunit` table
--
 
CREATE TABLE IF NOT EXISTS `subunit` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`unit_id` int(10) unsigned NOT NULL,
`texto` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
KEY `unit_id` (`unit_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
 
-- --------------------------------------------------------
 
--
-- structure `QuestionType` table
--
 
CREATE TABLE IF NOT EXISTS `QuestionType` (
`QuestionType` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`QuestionType`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
 
-- --------------------------------------------------------
 
--
-- structure `unit` table
--
 
CREATE TABLE IF NOT EXISTS `unit` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`texto` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
 
--
-- Restrictions
--
 
--
-- Filters `category` table
--
ALTER TABLE `category`
ADD CONSTRAINT `category_ibfk_1` FOREIGN KEY (`unit_id`) REFERENCES `unit` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
 
--
-- Filters `oneStructureQuestion` table
--
ALTER TABLE `oneStructureQuestion`
ADD CONSTRAINT `oneStructureQuestion_ibfk_3` FOREIGN KEY (`structure_id`) REFERENCES `structure` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `oneStructureQuestion_ibfk_4` FOREIGN KEY (`questionTxt_id`) REFERENCES `questionTxt` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `oneStructureQuestion_ibfk_5` FOREIGN KEY (`question_id`) REFERENCES `questions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
 
--
-- Filters `questions` table
--
ALTER TABLE `questions`
ADD CONSTRAINT `questions_ibfk_2` FOREIGN KEY (`category_id`) REFERENCES `category` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `questions_ibfk_1` FOREIGN KEY (`QuestionType`) REFERENCES `QuestionType` (`QuestionType`) ON DELETE CASCADE ON UPDATE CASCADE;
 
--
-- Filters `subunit` table
--
ALTER TABLE `subunit`
ADD CONSTRAINT `subunit_ibfk_1` FOREIGN KEY (`unit_id`) REFERENCES `unit` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
 
/*!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 */;

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.