Home >Database >Mysql Tutorial >Why am I getting MySQL Error Code #1089 with a PREFIX key on an integer column?
When attempting to create a table using the provided SQL statement, an error code #1089 is encountered. This error indicates an incorrect prefix key specification.
The problematic portion of the statement is:
PRIMARY KEY (`movie_id`(3))
In this line, you are attempting to create a prefix key on the first three bytes of the movie_id column. However, a prefix key is only supported for string data types. The movie_id column is an integer, which is not a string.
To resolve this error, you should remove the length specification from the primary key definition:
PRIMARY KEY (`movie_id`)
This will create a primary key on the entire movie_id column, without any prefix key considerations.
The above is the detailed content of Why am I getting MySQL Error Code #1089 with a PREFIX key on an integer column?. For more information, please follow other related articles on the PHP Chinese website!