CREATE TABLE `movies`.`movie`
( `movie_id` INT(3) NULL AUTO_INCREMENT, `movie_name` VARCHAR(25) NULL,
`movie_embedded_id` VARCHAR(50) NULL, `rating_no` INT(3) NULL
after selecting PRIMARY KEY when you create table, don't input any value in pop dialog
You can also get this error when creating an index if you specify a prefix length that is longer than the length of the actual column. If you tried to create an index containing someColumn(20)
but in the table someColumn is VARCHAR(15)
, then this error will occur.
With the part
PRIMARY KEY (`movie_id`(3))
you are telling mysql to create a sub part key* on the first 3 Bytes of movie id. This only works for string types.
You need to use
PRIMARY KEY (`movie_id`)
without providing a length.
*Is this sure the query resulting in the error? Never saw that on a primary key, its used for indexes.