向 MySQL 发出命令时,出现错误“#1075 - table 定义不正确;”
When issuing a command to MySQL, I'm getting that error "#1075 - Incorrect table definition;"
CREATE TABLE onscreen(
id int(2) not null AUTO_INCREMENT,
subject varchar(100) not null,
content varchar(100) not null,
date datetime not null
);
整个错误信息是:
Incorrect table definition; there can be only one auto column and it must be defined as a key
这很清楚:MySQL 要求您将 auto-increment 列定义为主键:
CREATE TABLE onscreen(
id int(2) not null AUTO_INCREMENT primary key, --> here
subject varchar(100) not null,
content varchar(100) not null,
date datetime not null
)
CREATE TABLE onscreen(
id int(2) not null AUTO_INCREMENT,
subject varchar(100) not null,
content varchar(100) not null,
date datetime not null
);
整个错误信息是:
Incorrect table definition; there can be only one auto column and it must be defined as a key
这很清楚:MySQL 要求您将 auto-increment 列定义为主键:
CREATE TABLE onscreen(
id int(2) not null AUTO_INCREMENT primary key, --> here
subject varchar(100) not null,
content varchar(100) not null,
date datetime not null
)