'how can i make my database er diagram to code?
I've made this ER diagram for my college project but i have to use forward engineering to see SQL code. MySQL version is 8.0.27
when i try it, it come up with error like below.
Executing SQL script in server ERROR: Error 3734: Failed to add the foreign key constraint. Missing column 'editor_ismi' for constraint 'fk_editor_ismi' in the referenced table 'editor'
SQL Code:
-- -----------------------------------------------------
-- Table `mydb`.`kitap`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`kitap` (
`isbn` VARCHAR(45) NOT NULL,
`editor_ismi` VARCHAR(45) NULL,
`yazar_ismi` VARCHAR(45) NULL,
`yazar_adres` VARCHAR(45) NULL,
`kitap_yili` INT NOT NULL,
`kitap_baslik` VARCHAR(45) NOT NULL,
`kitap_fiyat` VARCHAR(45) NOT NULL,
PRIMARY KEY (`isbn`),
INDEX `fk_editor_ismi_idx` (`editor_ismi` ASC) VISIBLE,
INDEX `fk_yazar_ismi_idx` (`yazar_ismi` ASC) VISIBLE,
INDEX `fk_yazar_adres_idx` (`yazar_adres` ASC) VISIBLE,
CONSTRAINT `fk_editor_ismi`
FOREIGN KEY (`editor_ismi`)
REFERENCES `mydb`.`editor` (`editor_ismi`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_yazar_ismi`
FOREIGN KEY (`yazar_ismi`)
REFERENCES `mydb`.`Yazar` (`yazar_ismi`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_yazar_adres`
FOREIGN KEY (`yazar_adres`)
REFERENCES `mydb`.`Yazar` (`yazar_ismi`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
SQL script execution finished: statements: 7 succeeded, 1 failed Fetching back view definitions in final form. Nothing to fetch
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|