MySQL에서 Forward Engineering을 시도하는 동안 오류 1064가 발생했습니다.
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이 처음이라 어떤 문제가 발생할 수 있는지 전혀 모르겠습니다.
MariaDB는 보이지 않는 인덱스를 지원하지 않기 때문에(MySQL 8.0만 지원) 오류가 발생합니다.VISIBLE
키워드
인덱스는 기본적으로 표시되므로 제거하는 것이 좋습니다.
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`),
CONSTRAINT `fk_Vendite_Prodotti`
FOREIGN KEY (`Prodotti_idProdotti`)
REFERENCES `mydb`.`Prodotti` (`idProdotti`)
ON DELETE NO ACTION
ON UPDATE NO ACTION
) ENGINE = InnoDB
언급URL : https://stackoverflow.com/questions/61369892/error-1064-in-mysql-trying-forward-engineering
'programing' 카테고리의 다른 글
event.preventDefault()(jQuery 사용)를 호출하는 수신기의 바인딩을 해제하는 방법은 무엇입니까? (0) | 2023.08.17 |
---|---|
Y축이 정수만 사용하도록 강제하는 방법 (0) | 2023.08.17 |
PHP의 추상 상수 - 자식 클래스가 상수를 정의하도록 강제합니다. (0) | 2023.08.17 |
일부 SQLite3 테이블의 데이터를 덤프하려면 어떻게 해야 합니까? (0) | 2023.08.17 |
문자열에 알파벳 문자가 포함되어 있는지 확인하려면 어떻게 해야 합니까? (0) | 2023.08.17 |