. Advertisement .
..3..
. Advertisement .
..4..
While I’m running my program, I get this error ”incorrect table definition; there can be only one auto column and it must be defined as a key”
CREATE TABLE book (
id INT AUTO_INCREMENT NOT NULL,
accepted_terms BIT(1) NOT NULL,
accepted_privacy BIT(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
I don’t have any experience with the ”incorrect table definition; there can be only one auto column and it must be defined as a key”. In this case, how should I change?
The cause: This error occurs because you didn’t set a primary key.
Solution: Adding the primary key to the
AUTO_INCREMENT
field to fix this error: