尝试插入SQL子句时出现语法错误

时间:2011-04-06 17:53:39

标签: mysql

我收到了这个错误:

 CREATE TABLE `libro`
 (
 `id` INTEGER  NOT NULL AUTO_INCREMENT,
 `autor_id` INTEGER(11),
 `titulo` VARCHAR(255),
 `paginas` VARCHAR(255)  NOT NULL,
 PRIMARY KEY (`id`),
 INDEX `libro_FI_1` (`autor_id`),
 CONSTRAINT `libro_FK_1`
 FOREIGN KEY (`autor_id`)
 REFERENCES `autor` (`id`)
 )Type=InnoDB
[propel-sql-exec] SQLSTATE[42000]: Syntax error or access violation: 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 'Type=InnoDB' at line 12

有什么想法吗?

此致

哈维

2 个答案:

答案 0 :(得分:5)

不应该是ENGINE=InnoDB吗?

答案 1 :(得分:1)

使用ENGINE代替Type

 CREATE TABLE `libro`
 (
  `id` INTEGER  NOT NULL AUTO_INCREMENT,
  `autor_id` INTEGER(11),
  `titulo` VARCHAR(255),
  `paginas` VARCHAR(255)  NOT NULL,
  PRIMARY KEY (`id`),
  INDEX `libro_FI_1` (`autor_id`),
  CONSTRAINT `libro_FK_1`
  FOREIGN KEY (`autor_id`)
  REFERENCES `autor` (`id`)
 )ENGINE=InnoDB