Skip to content
Advertisement

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
);

Advertisement

Answer

The entire error message is:

Incorrect table definition; there can be only one auto column and it must be defined as a key

This is clear enough: MySQL requires that you define the auto-increment column as a primary key:

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 
)

Demo on DB Fiddle

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement