The MySQL workbench is a great tool, but you have to keep your head on as it does no error 开发者_如何学Pythonchecking whatsoever.
So, it generated this SQL syntax to create a table and it won't work. And I can't figure out WHY
It gives me this error:
#1064 - You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version
for the right syntax to use near
') NULL DEFAULT NULL , `maaltijd` TINYINT(1) NOT NULL ,
`cheques` TINYINT(1'
at line 14
This is the query:
CREATE TABLE IF NOT EXISTS `nascholing`.`aanvraag` (
`aanvraagId` INT(11) NOT NULL AUTO_INCREMENT ,
`userId` BIGINT(20) NOT NULL ,
`creationDate` DATETIME NULL DEFAULT NULL ,
`vakGroep` INT(11) NULL DEFAULT NULL ,
`personeelType` INT(11) NOT NULL ,
`leeftijd` INT(11) NULL DEFAULT NULL ,
`thema` VARCHAR(255) NOT NULL ,
`intern` TINYINT(1) NULL DEFAULT -1 ,
`duur` INT(11) NOT NULL ,
`tijdens` INT(11) NULL DEFAULT NULL ,
`type` INT(11) NULL DEFAULT NULL ,
`voor` INT(11) NOT NULL ,
`kost` DOUBLE(11) NULL DEFAULT NULL ,
`maaltijd` TINYINT(1) NOT NULL ,
`cheques` TINYINT(1) NOT NULL ,
`betalingsmethode` INT(11) NOT NULL ,
`aanschafBoek` TINYINT(1) NOT NULL ,
`kostBoek` DOUBLE(11) NULL DEFAULT NULL ,
PRIMARY KEY (`aanvraagId`) ,
UNIQUE INDEX `aanvraagId_UNIQUE` (`aanvraagId` ASC) ,
INDEX `fk_aanvraag_user1` (`userId` ASC) ,
INDEX `fk_aanvraag_duur1` (`duur` ASC) ,
INDEX `fk_aanvraag_tijdens1` (`tijdens` ASC) ,
INDEX `fk_aanvraag_type1` (`type` ASC) ,
INDEX `fk_aanvraag_vakGroep1` (`vakGroep` ASC) ,
INDEX `fk_aanvraag_voorEmail1` (`voor` ASC) ,
INDEX `fk_aanvraag_betalingsMethode1` (`betalingsmethode` ASC) ,
CONSTRAINT `fk_aanvraag_user1`
FOREIGN KEY (`userId` )
REFERENCES `nascholing`.`user` (`userId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_aanvraag_duur1`
FOREIGN KEY (`duur` )
REFERENCES `nascholing`.`duur` (`duurId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_aanvraag_tijdens1`
FOREIGN KEY (`tijdens` )
REFERENCES `nascholing`.`tijdens` (`tijdensId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_aanvraag_type1`
FOREIGN KEY (`type` )
REFERENCES `nascholing`.`type` (`typeId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_aanvraag_vakGroep1`
FOREIGN KEY (`vakGroep` )
REFERENCES `nascholing`.`vakGroep` (`vakGroepId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_aanvraag_voorEmail1`
FOREIGN KEY (`voor` )
REFERENCES `nascholing`.`voorEmail` (`voorEmailId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_aanvraag_betalingsMethode1`
FOREIGN KEY (`betalingsmethode` )
REFERENCES `nascholing`.`betalingsMethode` (`betalingsMethodeId` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci;
There is a need to specify decimal point for type double
example,
`kost` DOUBLE(11, 2) NULL DEFAULT NULL, ...
so on for all the type double
Remove the length of the kost
column.
精彩评论