【发布时间】:2016-03-23 04:58:59
【问题描述】:
我正在输入以下内容:
CREATE TABLE events (
`id` mediumint unsigned not null auto_increment,
`user` varchar(30) not null,
`time` datetime not null,
`duration` decimal(5,2) default 1.0,
`title` tinytext not null,
`location` text default null,
`tag` ENUM(‘red’,’orange’,’yellow’,’green’,’blue’,’violet’,’brown’,’black’) default null,
PRIMARY KEY (`id`),
FOREIGN KEY (`user`) references users (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
我收到以下回复:
ERROR 1064 (42000): 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 '‘red’,’orange’,’yellow’,’green’,’blue’,’violet’,’brown' at line 8
这可能是眼睛疲倦的情况,但我很难过。我的枚举语句有什么问题?
【问题讨论】:
-
不要使用 Word 构建查询
-
@Strawberry 实际上,我使用的是 Mac 的 TextEdit,以确保文档是纯文本而不是富文本。
-
嗯,你从某个地方得到了聪明的报价!
标签: mysql create-table