mysql> CREATE TABLE Poster (
-> id smallint(6) unsigned NOT NULL AUTO_INCREMENT,
-> titre VARCHAR(200) NOT NULL,
-> description text NOT NULL,
-> image_link text NOT NULL,
-> nb_commentaires int unsigned,
-> nb_likes int unsigned,
-> user_id smallint(6) DEFAULT NOT NULL,
-> date_cree timestamp,
-> PRIMARY KEY (id) NOT NULL,
-> ) ENGINE=InnoDB;错误1064 (42000):您的SQL语法出现了错误;请检查与MySQL服务器版本相对应的手册,以便在第8行mysql>
中使用接近“NOT NULL,date_cree时间戳,主键(id) NULL,)ENGINE=InnoDB”的正确语法。
发布于 2020-11-27 11:27:34
如果您定义了一个default值,那么在允许或不允许NULL之后执行它
user_id smallint(6) NOT NULL DEFAULT 0也要改变这个
PRIMARY KEY (id) NOT NULL,对此
PRIMARY KEY (id)完整陈述:
CREATE TABLE Poster
(
id smallint(6) unsigned NOT NULL AUTO_INCREMENT,
titre VARCHAR(200) NOT NULL,
description text NOT NULL,
image_link text NOT NULL,
nb_commentaires int unsigned,
nb_likes int unsigned,
user_id smallint(6) NOT NULL DEFAULT 0,
date_cree timestamp,
PRIMARY KEY (id)
) ENGINE=InnoDB;https://stackoverflow.com/questions/65036574
复制相似问题