我正在使用MySQL Workbench尝试为数据库创建架构。当我尝试将其同步到服务器时,出现错误1064。这是完整的日志:
Executing SQL script in server
ERROR: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VISIBLE,
PRIMARY KEY (`id`),
CONSTRAINT `buildings_rel`
FOREIGN KEY (`bu' at line 10
SQL Code:
CREATE TABLE IF NOT EXISTS `rentals`.`apartments` (
`beds` INT(11) NOT NULL,
`baths` INT(11) NOT NULL,
`area` INT(11) NOT NULL,
`price_min` INT(11) NOT NULL,
`price_max` INT(11) NOT NULL,
`available_now` BIT(1) NOT NULL,
`building_id` INT(11) NULL DEFAULT NULL,
`id` INT(11) NOT NULL AUTO_INCREMENT,
INDEX `buildings_rel_idx` (`building_id` ASC) VISIBLE,
PRIMARY KEY (`id`),
CONSTRAINT `buildings_rel`
FOREIGN KEY (`building_id`)
REFERENCES `rentals`.`buildings` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
我不太了解SQL,因此在弄清楚到底是什么错误时遇到了麻烦。我希望Workbench能够创建正确的代码,令我感到有些惊讶的是,这似乎是一个小问题。任何帮助表示赞赏,谢谢。