2011-05-31 59 views
0

我已經使用MySQL工作臺5.0.30 OSS創建了我的數據庫的可視化設計,其中包含表和實體之間的關係。我從中導出了SQL創建腳本。MySQL工作臺和MySQL GUI工具之間的兼容性問題

我在Windows 7(32位)機器上使用SQL GUI工具5.0 r17來恢復數據庫,我看到幾個表missing.It拋出一個150錯誤表不能創建。

我不明白,如果它的兼容性問題,或者它是錯誤的錯誤圖。

如果有人可以幫忙,那將會很棒。以下是SQL腳本。

SET @[email protected]@UNIQUE_CHECKS, UNIQUE_CHECKS=0; 
SET @[email protected]@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; 
SET @[email protected]@SQL_MODE, SQL_MODE='TRADITIONAL'; 

CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ; 
USE `mydb`; 

-- ----------------------------------------------------- 
-- Table `mydb`.`Question_type` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`Question_type` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`Question_type` (
    `idQuestion_type` VARCHAR(255) NULL , 
    `Question_type_description` VARCHAR(255) NULL , 
    `Part_Marks` BOOLEAN NULL , 
    `Minimum_Marks` INT NULL , 
    `Maximum_Marks` INT NULL , 
    `Close_ended` BOOLEAN NULL , 
    PRIMARY KEY (`idQuestion_type`)) 
ENGINE = InnoDB 
COMMENT = 'The type of the question';  

-- ----------------------------------------------------- 
-- Table `mydb`.`Question` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`Question` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`Question` (
    `idQuestion` VARCHAR(255) NOT NULL , 
    `idQuestion_type` VARCHAR(255) NULL , 
    PRIMARY KEY (`idQuestion`) , 
    CONSTRAINT `fk_Question_Question_type` 
    FOREIGN KEY (`idQuestion_type`) 
    REFERENCES `mydb`.`Question_type` (`idQuestion_type`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION) 
ENGINE = InnoDB 
COMMENT = 'The main questionID table that links to everyother'; 

CREATE INDEX `fk_Question_Question_type` ON `mydb`.`Question` (`idQuestion_type` ASC) ;  

-- ----------------------------------------------------- 
-- Table `mydb`.`Answer_form` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`Answer_form` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`Answer_form` (
    `idAnswer_form` VARCHAR(255) NOT NULL , 
    `Form_description` MEDIUMTEXT NULL , 
    `Form_shortname` VARCHAR(45) NULL , 
    PRIMARY KEY (`idAnswer_form`)) 
ENGINE = InnoDB;  

-- ----------------------------------------------------- 
-- Table `mydb`.`Question_form` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`Question_form` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`Question_form` (
    `idQuestion_form` VARCHAR(255) NOT NULL , 
    `Form_description` MEDIUMTEXT NULL , 
    `Form_shortname` VARCHAR(45) NULL , 
    PRIMARY KEY (`idQuestion_form`)) 
ENGINE = InnoDB;  

-- ----------------------------------------------------- 
-- Table `mydb`.`QShort_Answer` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`QShort_Answer` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`QShort_Answer` (
    `idQShort_Answer` VARCHAR(255) NOT NULL , 
    `idQuestion` VARCHAR(255) NULL , 
    `idQuestion_form` VARCHAR(255) NULL , 
    `Question_content` LONGTEXT NULL , 
    `Upload_content` LONGBLOB NULL , 
    `One_word_answer` BOOLEAN NULL , 
    `One_answer1` VARCHAR(45) NULL , 
    `One_answer2` VARCHAR(45) NULL , 
    `idAnswer_form` VARCHAR(255) NULL , 
    `Answer_key1` VARCHAR(255) NULL , 
    `Answer_key2` VARCHAR(255) NULL , 
    `Answer_key3` VARCHAR(255) NULL , 
    `Answer_key4` VARCHAR(255) NULL , 
    `Answer_key5` VARCHAR(255) NULL , 
    `Answer_key6` VARCHAR(255) NULL , 
    `No_of_words` INT NULL , 
    PRIMARY KEY (`idQShort_Answer`) , 
    CONSTRAINT `fk_QShort_Answer_Answer_form` 
    FOREIGN KEY (`idAnswer_form`) 
    REFERENCES `mydb`.`Answer_form` (`idAnswer_form`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_QShort_Answer_Question_form` 
    FOREIGN KEY (`idQuestion_form`) 
    REFERENCES `mydb`.`Question_form` (`idQuestion_form`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_QShort_Answer_Question` 
    FOREIGN KEY (`idQuestion`) 
    REFERENCES `mydb`.`Question` (`idQuestion`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION) 
ENGINE = InnoDB 
COMMENT = 'The short answer question table'; 

CREATE INDEX `fk_QShort_Answer_Answer_form` ON `mydb`.`QShort_Answer` (`idAnswer_form` ASC) ; 

CREATE INDEX `fk_QShort_Answer_Question_form` ON `mydb`.`QShort_Answer` (`idQuestion_form` ASC) ; 

CREATE INDEX `fk_QShort_Answer_Question` ON `mydb`.`QShort_Answer` (`idQuestion` ASC) ;  

-- ----------------------------------------------------- 
-- Table `mydb`.`QLong_Answer` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`QLong_Answer` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`QLong_Answer` (
    `idQLong_Answer` VARCHAR(255) NOT NULL , 
    `idQuestion` VARCHAR(255) NULL , 
    `idQuestion_form` VARCHAR(255) NULL , 
    `Question_content` LONGTEXT NULL , 
    `Upload_content` LONGBLOB NULL , 
    `idAnswer_form` VARCHAR(255) NULL , 
    `Answer_key1` VARCHAR(255) NULL , 
    `Answer_key2` VARCHAR(255) NULL , 
    `Answer_key3` VARCHAR(255) NULL , 
    `Answer_key4` VARCHAR(255) NULL , 
    `Answer_key5` VARCHAR(255) NULL , 
    `Answer_key6` VARCHAR(255) NULL , 
    `No_of_words` INT NULL , 
    `Rubric_used` BOOLEAN NULL , 
    PRIMARY KEY (`idQLong_Answer`) , 
    CONSTRAINT `fk_QLong_Answer_Question_form` 
    FOREIGN KEY (`idQuestion_form`) 
    REFERENCES `mydb`.`Question_form` (`idQuestion_form`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_QLong_Answer_Answer_form` 
    FOREIGN KEY (`idAnswer_form`) 
    REFERENCES `mydb`.`Answer_form` (`idAnswer_form`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_QLong_Answer_Question` 
    FOREIGN KEY (`idQuestion`) 
    REFERENCES `mydb`.`Question` (`idQuestion`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION) 
ENGINE = InnoDB; 

CREATE INDEX `fk_QLong_Answer_Question_form` ON `mydb`.`QLong_Answer` (`idQuestion_form` ASC) ; 

CREATE INDEX `fk_QLong_Answer_Answer_form` ON `mydb`.`QLong_Answer` (`idAnswer_form` ASC) ; 

CREATE INDEX `fk_QLong_Answer_Question` ON `mydb`.`QLong_Answer` (`idQuestion` ASC) ;  

-- ----------------------------------------------------- 
-- Table `mydb`.`Multichoice_question` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`Multichoice_question` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`Multichoice_question` (
    `idMultichoice_question` VARCHAR(255) NOT NULL , 
    `idQuestion` VARCHAR(255) NULL , 
    `idQuestion_form` VARCHAR(255) NULL , 
    `Question_content` LONGTEXT NULL , 
    `Upload_content` LONGBLOB NULL , 
    `Option1` MEDIUMTEXT NULL , 
    `Option2` MEDIUMTEXT NULL , 
    `Option3` MEDIUMTEXT NULL , 
    `Option4` MEDIUMTEXT NULL , 
    `Option5` MEDIUMTEXT NULL , 
    `Option6` MEDIUMTEXT NULL , 
    PRIMARY KEY (`idMultichoice_question`) , 
    CONSTRAINT `fk_Multichoice_question_Question_form` 
    FOREIGN KEY (`idQuestion_form`) 
    REFERENCES `mydb`.`Question_form` (`idQuestion_form`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_Multichoice_question_Question` 
    FOREIGN KEY (`idQuestion`) 
    REFERENCES `mydb`.`Question` (`idQuestion`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION) 
ENGINE = InnoDB 
COMMENT = 'Multiple choice Questions'; 

CREATE INDEX `fk_Multichoice_question_Question_form` ON `mydb`.`Multichoice_question` (`idQuestion_form` ASC) ; 

CREATE INDEX `fk_Multichoice_question_Question` ON `mydb`.`Multichoice_question` (`idQuestion` ASC) ;  

-- ----------------------------------------------------- 
-- Table `mydb`.`QCalculated` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`QCalculated` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`QCalculated` (
    `idQCalculated` VARCHAR(255) NOT NULL , 
    `idQuestion` VARCHAR(255) NULL , 
    `idQuestion_form` VARCHAR(255) NULL , 
    `Question_content` LONGTEXT NULL , 
    `Upload_content` LONGBLOB NULL , 
    `Number_of_wildcards` INT NULL , 
    `Wildcard1` VARCHAR(45) NULL , 
    `Wvalue1` INT NULL , 
    `Wmax1` INT NULL , 
    `Wmin1` INT NULL , 
    `Wdecimal1` BOOLEAN NULL , 
    `Wildcard2` VARCHAR(45) NULL , 
    `Wvalue2` INT NULL , 
    `Wmax2` INT NULL , 
    `Wmin2` INT NULL , 
    `Wdecimal2` BOOLEAN NULL , 
    `Wildcard3` VARCHAR(45) NULL , 
    `Wvalue3` INT NULL , 
    `Wmax3` INT NULL , 
    `Wmin3` INT NULL , 
    `Wdecimal3` BOOLEAN NULL , 
    `Wildcard4` VARCHAR(45) NULL , 
    `Wvalue4` INT NULL , 
    `Wmax4` INT NULL , 
    `Wmin4` INT NULL , 
    `Wdecimal4` BOOLEAN NULL , 
    `Wildcard5` VARCHAR(45) NULL , 
    `Wvalue5` INT NULL , 
    `Wmax5` INT NULL , 
    `Wmin5` INT NULL , 
    `Wdecimal5` BOOLEAN NULL , 
    `Wildcard6` VARCHAR(45) NULL , 
    `Wvalue6` INT NULL , 
    `Wmax6` INT NULL , 
    `Wmin6` INT NULL , 
    `Wdecimal6` BOOLEAN NULL , 
    `Wildcard7` VARCHAR(45) NULL , 
    `Wvalue7` INT NULL , 
    `Wmax7` INT NULL , 
    `Wmin7` INT NULL , 
    `Wdecimal7` BOOLEAN NULL , 
    `Formula` VARCHAR(255) NULL , 
    `Formula_unit1` VARCHAR(45) NULL , 
    `Formula_unit2` VARCHAR(45) NULL , 
    `Formula_unit3` VARCHAR(45) NULL , 
    `Formula_unit4` VARCHAR(45) NULL , 
    `Formula_unit5` VARCHAR(45) NULL , 
    `Tolerance` INT NULL , 
    PRIMARY KEY (`idQCalculated`) , 
    CONSTRAINT `fk_QCalculated_Question_form` 
    FOREIGN KEY (`idQuestion_form`) 
    REFERENCES `mydb`.`Question_form` (`idQuestion_form`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_QCalculated_Question` 
    FOREIGN KEY (`idQuestion`) 
    REFERENCES `mydb`.`Question` (`idQuestion`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION) 
ENGINE = InnoDB 
COMMENT = 'Generalized calculation type question'; 

CREATE INDEX `fk_QCalculated_Question_form` ON `mydb`.`QCalculated` (`idQuestion_form` ASC) ; 

CREATE INDEX `fk_QCalculated_Question` ON `mydb`.`QCalculated` (`idQuestion` ASC) ;  

-- ----------------------------------------------------- 
-- Table `mydb`.`Board` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`Board` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`Board` (
    `idBoard` VARCHAR(255) NOT NULL , 
    `Board_description` MEDIUMTEXT NULL , 
    `Board_shortname` VARCHAR(45) NULL , 
    `Class` VARCHAR(45) NULL , 
    `Year` INT NULL , 
    PRIMARY KEY (`idBoard`)) 
ENGINE = InnoDB;  

-- ----------------------------------------------------- 
-- Table `mydb`.`Class_subject_term` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`Class_subject_term` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`Class_subject_term` (
    `idCST` VARCHAR(255) NOT NULL , 
    `idBoard` VARCHAR(255) NULL , 
    `Class_shortname` VARCHAR(45) NULL , 
    `Class_description` MEDIUMTEXT NULL , 
    `Subject_description` MEDIUMTEXT NULL , 
    `Subject_shortname` MEDIUMTEXT NULL , 
    `Subject_group` VARCHAR(255) NULL , 
    PRIMARY KEY (`idCST`) , 
    CONSTRAINT `fk_Class_subject_term_Board` 
    FOREIGN KEY (`idBoard`) 
    REFERENCES `mydb`.`Board` (`idBoard`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION) 
ENGINE = InnoDB; 

CREATE INDEX `fk_Class_subject_term_Board` ON `mydb`.`Class_subject_term` (`idBoard` ASC) ;  

-- ----------------------------------------------------- 
-- Table `mydb`.`Educational_objectives` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`Educational_objectives` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`Educational_objectives` (
    `idEO` VARCHAR(255) NOT NULL , 
    `EO_shortname` VARCHAR(45) NULL , 
    `EO_description` MEDIUMTEXT NULL , 
    PRIMARY KEY (`idEO`)) 
ENGINE = InnoDB;  

-- ----------------------------------------------------- 
-- Table `mydb`.`Chapter_topic` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`Chapter_topic` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`Chapter_topic` (
    `idChaptop` VARCHAR(255) NOT NULL , 
    `idCST` VARCHAR(255) NULL , 
    `Chapter_shortname` VARCHAR(45) NULL , 
    `Chapter_description` MEDIUMTEXT NULL , 
    `Chapter_group` VARCHAR(255) NULL , 
    `idTopic` VARCHAR(255) NULL , 
    `Topic_description` MEDIUMTEXT NULL , 
    `Term_description` MEDIUMTEXT NULL , 
    `idEO` VARCHAR(255) NULL , 
    PRIMARY KEY (`idChaptop`) , 
    CONSTRAINT `fk_Chapter_topic_Educational_objectives` 
    FOREIGN KEY (`idEO`) 
    REFERENCES `mydb`.`Educational_objectives` (`idEO`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_Chapter_topic_Class_subject_term` 
    FOREIGN KEY (`idCST`) 
    REFERENCES `mydb`.`Class_subject_term` (`idCST`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION) 
ENGINE = InnoDB; 

CREATE INDEX `fk_Chapter_topic_Educational_objectives` ON `mydb`.`Chapter_topic` (`idEO` ASC) ; 

CREATE INDEX `fk_Chapter_topic_Class_subject_term` ON `mydb`.`Chapter_topic` (`idCST` ASC) ;  

-- ----------------------------------------------------- 
-- Table `mydb`.`Topic_concept` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`Topic_concept` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`Topic_concept` (
    `idTopcon` VARCHAR(255) NOT NULL , 
    `idTopic` VARCHAR(255) NULL , 
    `Concept_shortname` VARCHAR(45) NULL , 
    `Concept_description` MEDIUMTEXT NULL , 
    PRIMARY KEY (`idTopcon`) , 
    CONSTRAINT `fk_Topic_concept_Chapter_topic` 
    FOREIGN KEY (`idTopic`) 
    REFERENCES `mydb`.`Chapter_topic` (`idTopic`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION) 
ENGINE = InnoDB; 

CREATE INDEX `fk_Topic_concept_Chapter_topic` ON `mydb`.`Topic_concept` (`idTopic` ASC) ;  

-- ----------------------------------------------------- 
-- Table `mydb`.`Question_properties` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`Question_properties` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`Question_properties` (
    `idQuestion_properties` VARCHAR(255) NOT NULL , 
    `idQuestion` VARCHAR(255) NULL , 
    `idBoard` VARCHAR(255) NULL , 
    `Board_shortname` VARCHAR(45) NULL , 
    `idCST` VARCHAR(255) NULL , 
    `Class_shortname` VARCHAR(45) NULL , 
    `idChapTop` VARCHAR(255) NULL , 
    `Chapter_shortname` VARCHAR(45) NULL , 
    `idTopcon` VARCHAR(255) NULL , 
    `Marks` INT NULL , 
    `Negative Marks` BOOLEAN NULL , 
    `Repeat` BIGINT NULL , 
    `From_textbook` BOOLEAN NULL , 
    `FA_only` BOOLEAN NULL , 
    PRIMARY KEY (`idQuestion_properties`) , 
    CONSTRAINT `fk_Question_properties_Board` 
    FOREIGN KEY (`idBoard`) 
    REFERENCES `mydb`.`Board` (`idBoard`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_Question_properties_Class_subject_term` 
    FOREIGN KEY (`idCST`) 
    REFERENCES `mydb`.`Class_subject_term` (`idCST`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_Question_properties_Chapter_topic` 
    FOREIGN KEY (`idChapTop`) 
    REFERENCES `mydb`.`Chapter_topic` (`idChaptop`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_Question_properties_Topic_concept` 
    FOREIGN KEY (`idTopcon`) 
    REFERENCES `mydb`.`Topic_concept` (`idTopcon`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_Question_properties_Question` 
    FOREIGN KEY (`idQuestion`) 
    REFERENCES `mydb`.`Question` (`idQuestion`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION) 
ENGINE = InnoDB 
COMMENT = 'Properties of the Question'; 

CREATE INDEX `fk_Question_properties_Board` ON `mydb`.`Question_properties` (`idBoard` ASC) ; 

CREATE INDEX `fk_Question_properties_Class_subject_term` ON `mydb`.`Question_properties` (`idCST` ASC) ; 

CREATE INDEX `fk_Question_properties_Chapter_topic` ON `mydb`.`Question_properties` (`idChapTop` ASC) ; 

CREATE INDEX `fk_Question_properties_Topic_concept` ON `mydb`.`Question_properties` (`idTopcon` ASC) ; 

CREATE INDEX `fk_Question_properties_Question` ON `mydb`.`Question_properties` (`idQuestion` ASC) ;  

-- ----------------------------------------------------- 
-- Table `mydb`.`Rubric` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`Rubric` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`Rubric` (
    `idRubdim` VARCHAR(255) NOT NULL , 
    `Rubric_shortname` VARCHAR(45) NULL , 
    `Rubric_dimension` VARCHAR(45) NULL , 
    `Rubric_dimension_description` MEDIUMTEXT NULL , 
    `Scale1` VARCHAR(45) NULL , 
    `Scale1_description` MEDIUMTEXT NULL , 
    `Scale1_detail_description` LONGTEXT NULL , 
    `Scale2` VARCHAR(45) NULL , 
    `Scale2_description` MEDIUMTEXT NULL , 
    `Scale2_detail_description` LONGTEXT NULL , 
    `Scale3` VARCHAR(45) NULL , 
    `Scale3_description` MEDIUMTEXT NULL , 
    `Scale3_detail_description` LONGTEXT NULL , 
    `Scale4` VARCHAR(45) NULL , 
    `Scale4_description` MEDIUMTEXT NULL , 
    `Scale4_detail_description` LONGTEXT NULL , 
    `Rubric_category` VARCHAR(45) NULL , 
    `Group_rubric` BOOLEAN NULL , 
    PRIMARY KEY (`idRubdim`)) 
ENGINE = InnoDB;  

-- ----------------------------------------------------- 
-- Table `mydb`.`Question_Rubric` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`Question_Rubric` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`Question_Rubric` (
    `idRubric` VARCHAR(255) NOT NULL , 
    `idQRubdim1` VARCHAR(255) NULL , 
    `QRWeightage1` INT NULL , 
    `idQRubdim2` VARCHAR(255) NULL , 
    `QRWeightage2` INT NULL , 
    `idQRubdim3` VARCHAR(255) NULL , 
    `QRWeightage3` INT NULL , 
    `idQRubdim4` VARCHAR(255) NULL , 
    `QRWeightage4` INT NULL , 
    `idQRubdim5` VARCHAR(255) NULL , 
    `QRWeightage5` INT NULL , 
    `idQRubdim6` VARCHAR(255) NULL , 
    `QRWeightage6` INT NULL , 
    `idQRubdim7` VARCHAR(255) NULL , 
    `QRWeightage7` INT NULL , 
    `idQRubdim8` VARCHAR(255) NULL , 
    `QRWeightage8` INT NULL , 
    PRIMARY KEY (`idRubric`) , 
    CONSTRAINT `fk_Question_Rubric_Rubric` 
    FOREIGN KEY (`idQRubdim1`) 
    REFERENCES `mydb`.`Rubric` (`idRubdim`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_Question_Rubric_Rubric1` 
    FOREIGN KEY (`idQRubdim2`) 
    REFERENCES `mydb`.`Rubric` (`idRubdim`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_Question_Rubric_Rubric2` 
    FOREIGN KEY (`idQRubdim3`) 
    REFERENCES `mydb`.`Rubric` (`idRubdim`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_Question_Rubric_Rubric3` 
    FOREIGN KEY (`idQRubdim4`) 
    REFERENCES `mydb`.`Rubric` (`idRubdim`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_Question_Rubric_Rubric4` 
    FOREIGN KEY (`idQRubdim5`) 
    REFERENCES `mydb`.`Rubric` (`idRubdim`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_Question_Rubric_Rubric5` 
    FOREIGN KEY (`idQRubdim6`) 
    REFERENCES `mydb`.`Rubric` (`idRubdim`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_Question_Rubric_Rubric6` 
    FOREIGN KEY (`idQRubdim7`) 
    REFERENCES `mydb`.`Rubric` (`idRubdim`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_Question_Rubric_Rubric7` 
    FOREIGN KEY (`idQRubdim8`) 
    REFERENCES `mydb`.`Rubric` (`idRubdim`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION) 
ENGINE = InnoDB; 

CREATE INDEX `fk_Question_Rubric_Rubric` ON `mydb`.`Question_Rubric` (`idQRubdim1` ASC) ; 

CREATE INDEX `fk_Question_Rubric_Rubric1` ON `mydb`.`Question_Rubric` (`idQRubdim2` ASC) ; 

CREATE INDEX `fk_Question_Rubric_Rubric2` ON `mydb`.`Question_Rubric` (`idQRubdim3` ASC) ; 

CREATE INDEX `fk_Question_Rubric_Rubric3` ON `mydb`.`Question_Rubric` (`idQRubdim4` ASC) ; 

CREATE INDEX `fk_Question_Rubric_Rubric4` ON `mydb`.`Question_Rubric` (`idQRubdim5` ASC) ; 

CREATE INDEX `fk_Question_Rubric_Rubric5` ON `mydb`.`Question_Rubric` (`idQRubdim6` ASC) ; 

CREATE INDEX `fk_Question_Rubric_Rubric6` ON `mydb`.`Question_Rubric` (`idQRubdim7` ASC) ; 

CREATE INDEX `fk_Question_Rubric_Rubric7` ON `mydb`.`Question_Rubric` (`idQRubdim8` ASC) ;  

-- ----------------------------------------------------- 
-- Table `mydb`.`Learning_objectives` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`Learning_objectives` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`Learning_objectives` (
    `idLO` VARCHAR(255) NOT NULL , 
    `LO_shortname` VARCHAR(45) NULL , 
    `LO_description` MEDIUMTEXT NULL , 
    `idCS` VARCHAR(255) NULL , 
    `CS_shortname` VARCHAR(45) NULL , 
    `CS_description` MEDIUMTEXT NULL , 
    PRIMARY KEY (`idLO`)) 
ENGINE = InnoDB;  

-- ----------------------------------------------------- 
-- Table `mydb`.`QDifficulty` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`QDifficulty` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`QDifficulty` (
    `idQDifficulty` VARCHAR(255) NOT NULL , 
    `Difficulty_description` MEDIUMTEXT NULL , 
    PRIMARY KEY (`idQDifficulty`)) 
ENGINE = InnoDB;  

-- ----------------------------------------------------- 
-- Table `mydb`.`QNR_Tags` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`QNR_Tags` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`QNR_Tags` (
    `idQNR_Tags` VARCHAR(255) NOT NULL , 
    `idQuestion` VARCHAR(255) NULL , 
    `idRubric1` VARCHAR(255) NULL , 
    `idRubric2` VARCHAR(255) NULL , 
    `idQCS1` VARCHAR(255) NULL , 
    `idQLO1` VARCHAR(255) NULL , 
    `idQCS2` VARCHAR(255) NULL , 
    `idQLO2` VARCHAR(255) NULL , 
    `idQDifficulty` VARCHAR(255) NULL , 
    `idQuestion_form` VARCHAR(255) NULL , 
    `idComment_set1` VARCHAR(255) NULL , 
    `idComment_set2` VARCHAR(255) NULL , 
    PRIMARY KEY (`idQNR_Tags`) , 
    CONSTRAINT `fk_QNR_Tags_Question_Rubric` 
    FOREIGN KEY (`idRubric1`) 
    REFERENCES `mydb`.`Question_Rubric` (`idRubric`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_QNR_Tags_Question_Rubric1` 
    FOREIGN KEY (`idRubric2`) 
    REFERENCES `mydb`.`Question_Rubric` (`idRubric`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_QNR_Tags_Learning_objectives` 
    FOREIGN KEY (`idQLO1`) 
    REFERENCES `mydb`.`Learning_objectives` (`idLO`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_QNR_Tags_Learning_objectives2` 
    FOREIGN KEY (`idQLO2`) 
    REFERENCES `mydb`.`Learning_objectives` (`idLO`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_QNR_Tags_Learning_objectives1` 
    FOREIGN KEY (`idQCS1`) 
    REFERENCES `mydb`.`Learning_objectives` (`idCS`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_QNR_Tags_Learning_objectives3` 
    FOREIGN KEY (`idQCS2`) 
    REFERENCES `mydb`.`Learning_objectives` (`idCS`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_QNR_Tags_QDifficulty` 
    FOREIGN KEY (`idQDifficulty`) 
    REFERENCES `mydb`.`QDifficulty` (`idQDifficulty`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_QNR_Tags_Question` 
    FOREIGN KEY (`idQuestion`) 
    REFERENCES `mydb`.`Question` (`idQuestion`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION) 
ENGINE = InnoDB; 

CREATE INDEX `fk_QNR_Tags_Question_Rubric` ON `mydb`.`QNR_Tags` (`idRubric1` ASC) ; 

CREATE INDEX `fk_QNR_Tags_Question_Rubric1` ON `mydb`.`QNR_Tags` (`idRubric2` ASC) ; 

CREATE INDEX `fk_QNR_Tags_Learning_objectives` ON `mydb`.`QNR_Tags` (`idQLO1` ASC) ; 

CREATE INDEX `fk_QNR_Tags_Learning_objectives2` ON `mydb`.`QNR_Tags` (`idQLO2` ASC) ; 

CREATE INDEX `fk_QNR_Tags_Learning_objectives1` ON `mydb`.`QNR_Tags` (`idQCS1` ASC) ; 

CREATE INDEX `fk_QNR_Tags_Learning_objectives3` ON `mydb`.`QNR_Tags` (`idQCS2` ASC) ; 

CREATE INDEX `fk_QNR_Tags_QDifficulty` ON `mydb`.`QNR_Tags` (`idQDifficulty` ASC) ; 

CREATE INDEX `fk_QNR_Tags_Question` ON `mydb`.`QNR_Tags` (`idQuestion` ASC) ;  

-- ----------------------------------------------------- 
-- Table `mydb`.`Comments` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`Comments` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`Comments` (
    `idComment` VARCHAR(255) NOT NULL , 
    `Comment_description` MEDIUMTEXT NULL , 
    `Comment_shortname` VARCHAR(45) NULL , 
    PRIMARY KEY (`idComment`)) 
ENGINE = InnoDB;  

-- ----------------------------------------------------- 
-- Table `mydb`.`Comment_set` 
-- ----------------------------------------------------- 
DROP TABLE IF EXISTS `mydb`.`Comment_set` ; 

CREATE TABLE IF NOT EXISTS `mydb`.`Comment_set` (
    `idComment_set` VARCHAR(255) NOT NULL , 
    `Comment_set_shortname` VARCHAR(45) NULL , 
    `Comment_set_description` MEDIUMTEXT NULL , 
    `idComment1` VARCHAR(255) NULL , 
    `idComment2` VARCHAR(255) NULL , 
    `idComment3` VARCHAR(255) NULL , 
    `idComment4` VARCHAR(255) NULL , 
    `idComment5` VARCHAR(255) NULL , 
    `idComment6` VARCHAR(255) NULL , 
    PRIMARY KEY (`idComment_set`) , 
    CONSTRAINT `fk_Comment_set_Comments` 
    FOREIGN KEY (`idComment1`) 
    REFERENCES `mydb`.`Comments` (`idComment`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_Comment_set_Comments1` 
    FOREIGN KEY (`idComment2`) 
    REFERENCES `mydb`.`Comments` (`idComment`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_Comment_set_Comments2` 
    FOREIGN KEY (`idComment3`) 
    REFERENCES `mydb`.`Comments` (`idComment`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_Comment_set_Comments3` 
    FOREIGN KEY (`idComment4`) 
    REFERENCES `mydb`.`Comments` (`idComment`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_Comment_set_Comments4` 
    FOREIGN KEY (`idComment5`) 
    REFERENCES `mydb`.`Comments` (`idComment`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION, 
    CONSTRAINT `fk_Comment_set_Comments5` 
    FOREIGN KEY (`idComment6`) 
    REFERENCES `mydb`.`Comments` (`idComment`) 
    ON DELETE NO ACTION 
    ON UPDATE NO ACTION) 
ENGINE = InnoDB; 

CREATE INDEX `fk_Comment_set_Comments` ON `mydb`.`Comment_set` (`idComment1` ASC) ; 

CREATE INDEX `fk_Comment_set_Comments1` ON `mydb`.`Comment_set` (`idComment2` ASC) ; 

CREATE INDEX `fk_Comment_set_Comments2` ON `mydb`.`Comment_set` (`idComment3` ASC) ; 

CREATE INDEX `fk_Comment_set_Comments3` ON `mydb`.`Comment_set` (`idComment4` ASC) ; 

CREATE INDEX `fk_Comment_set_Comments4` ON `mydb`.`Comment_set` (`idComment5` ASC) ; 

CREATE INDEX `fk_Comment_set_Comments5` ON `mydb`.`Comment_set` (`idComment6` ASC) ; 

SET [email protected]_SQL_MODE; 
SET [email protected]_FOREIGN_KEY_CHECKS; 
SET [email protected]_UNIQUE_CHECKS; 
+0

普羅蒂普:儘量削減你的代碼粘貼到最低限度,以描述或複製您的問題。將所有代碼傾倒到問題中更有可能會嚇跑潛在的幫助。此外,削減代碼的行爲有時可以幫助您確定實際問題。我會**強烈**建議你閱讀[這篇博客文章](http://blog.stackoverflow.com/2010/10/asking-better-questions/1228)提示如何提出更好的問題。 – Will 2011-06-01 13:30:50

回答