6
I created a diagram of a BD using Mysql Workbench and had it generated. But the following error happens when I run the query:
Executing SQL script in server
ERROR: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '
INDEX `fk_carro_leilao1_idx` (`leilao_idleilao` ASC) VISIBLE,
CONSTRAINT `f' at line 15
SQL code:
-- -----------------------------------------------------
-- Table `carrosleilao`.`carro`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `carrosleilao`.`carro` (
`idcarro` INT NOT NULL AUTO_INCREMENT,
`modelo` VARCHAR(45) NOT NULL,
`marca` VARCHAR(45) NOT NULL,
`ano` VARCHAR(5) NOT NULL,
`combustivel` VARCHAR(45) NOT NULL,
`precoFIPE` VARCHAR(45) NOT NULL,
`referencia` VARCHAR(45) NOT NULL,
`preco_idpreco` INT NOT NULL,
`leilao_idleilao` INT NOT NULL,
PRIMARY KEY (`idcarro`, `preco_idpreco`, `leilao_idleilao`),
INDEX `fk_carro_preco_idx` (`preco_idpreco` ASC) VISIBLE,
INDEX `fk_carro_leilao1_idx` (`leilao_idleilao` ASC) VISIBLE,
CONSTRAINT `fk_carro_preco`
FOREIGN KEY (`preco_idpreco`)
REFERENCES `carrosleilao`.`preco` (`idpreco`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_carro_leilao1`
FOREIGN KEY (`leilao_idleilao`)
REFERENCES `carrosleilao`.`leilao` (`idleilao`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
I could not identify the problem because the script was generated by the tool itself.