CREATE TABLE OWLUpdates(
id INT AUTO_INCREMENT NOT NULL,
website INT, INDEX website__idx (website), FOREIGN KEY (website) REFERENCES OWLWebsite (id) ON DELETE CASCADE,
suburl VARCHAR(255),
sendtimes INT,
title VARCHAR(255) UNIQUE,
description LONGTEXT,
is_show CHAR(1),
reads INT,
degrees INT,
mtime DATETIME,
PRIMARY KEY(id)
) ENGINE=InnoDB CHARACTER SET utf8;
错误是什么?? web2py 报告:
(1064, u"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 'reads INT,\n degrees INT,\n mtime DATETIME,\n PRIMARY KEY(id)\n) ENGINE=Inn' at line 9")
最佳答案
READS
是 MySQL 中的保留关键字。为了使用关键字,你应该用反引号把它包起来,
`READS` INT
但作为一个建议,不要使用保留关键字以防止将来出现问题。
关于mysql - 为什么这个mysql语法错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15730415/