Hello people, I have problems with creating tables & foreign key. (errno:150) here is a screenshot Updated Image: http://img264.imagevenue.com/img.php?image=14866_db_122_223lo.jpg
Maybe the problem is the database design.
-- -----------------------------------------------------
-- Table `mydb`.`projekt_user`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`projekt_user` (
`UserID` INT NOT NULL ,
`Name` VARCHAR(45) NULL ,
PRIMARY KEY (`UserID`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`projekt_auswahl`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`projekt_auswahl` (
`UserID` INT NOT NULL ,
`projekt_id` INT NOT NULL ,
`projekt_kategorie_id` INT NOT NULL ,
`projekt_attachment` VARCHAR(45) NULL ,
PRIMARY KEY (`UserID`, `projekt_id`, `projekt_kategorie_id`) ,
INDEX `UserID` (`UserID` ASC) ,
CONSTRAINT `UserID`
FOREIGN KEY (`UserID` )
REFERENCES `mydb`.`projekt_user` (`UserID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`projekt_kategorien`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`projekt_kategorien` (
`projekt_kategorie_id` INT NOT NULL ,
`kategorie` VARCHAR(45) NULL ,
PRIMARY KEY (`projekt_kategorie_id`) ,
INDEX `projekt_kategorie_id` (`projekt_kategorie_id` ASC) ,
CONSTRAINT `projekt_kategorie_id`
FOREIGN KEY (`projekt_kategorie_id` )
REFERENCES `mydb`.`projekt_auswahl` (`projekt_kategorie_id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `mydb`.`projekte`
-- -----------------------------------------------------
CREATE TABLE `projekte` (
`projekt_id` INT NOT NULL ,
`projektname` VARCHAR(45) NULL ,
`projekt_status` VARCHAR(45) NULL ,
PRIMARY KEY (`projekt_id`) ,
INDEX `projekt_id` (`projekt_id` ASC) ,
CONSTRAINT `projekt_id`
FOREIGN KEY (`projekt_id` )
REFERENCES `mydb`.`projekt_auswahl` (`projekt_id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;