#1064 - 您的SQL语法出错;查看与您的MySQL服务器版本对应的手册,以便在第10行的'CONSTRAINT FOREIGN KEY(entry_id
)参考entry
(entry_id
)ON DELETE CAS'附近使用正确的语法
CREATE TABLE IF NOT EXISTS `comment` (
`comment_id` int(11) NOT NULL AUTO_INCREMENT,
`entry_id` int(11) NOT NULL,
`comment_name` varchar(100) NOT NULL,
`comment_email` varchar(100) NOT NULL,
`comment_body` text NOT NULL,
`comment_state` tinyint(1) NOT NULL DEFAULT '0',
`comment_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`comment_id`)
CONSTRAINT FOREIGN KEY (`entry_id`) REFERENCES `entry`(`entry_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=34 ;
答案 0 :(得分:3)
您忘记了PRIMARY KEY行后的逗号。
答案 1 :(得分:1)
是的,您需要添加逗号(,
)
PRIMARY KEY (`comment_id`),