【发布时间】:2020-08-05 18:07:37
【问题描述】:
我是 MySQL 新手,当我尝试执行“Forward Engineer”时遇到了这个错误:
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 '
CONSTRAINT `fk_Vendite_Prodotti`
FOREIGN KEY (`Prodotti_idProdotti`)
' at line 11
SQL Code:
-- -----------------------------------------------------
-- Table `mydb`.`Vendite`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `mydb`.`Vendite` (
`idVendite` INT NOT NULL,
`dataVendita` DATETIME NULL,
`qta` INT NULL,
`costo` FLOAT NULL,
`Prodotti_idProdotti` INT NOT NULL,
PRIMARY KEY (`idVendite`),
INDEX `fk_Vendite_Prodotti_idx` (`Prodotti_idProdotti` ASC) VISIBLE,
CONSTRAINT `fk_Vendite_Prodotti`
FOREIGN KEY (`Prodotti_idProdotti`)
REFERENCES `mydb`.`Prodotti` (`idProdotti`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
SQL script execution finished: statements: 6 succeeded, 1 failed
Fetching back view definitions in final form.
Nothing to fetch
我知道有很多关于这个主题的问题,但我看到它是一个非常具体的问题。同样是 SQL 新手,我不知道问题可能是什么
【问题讨论】:
标签: mysql sql syntax mariadb create-table