I keep getting this mysql error code #1089

前端 未结 3 1870
心在旅途
心在旅途 2020-11-30 06:45
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         


        
相关标签:
3条回答
  • 2020-11-30 06:54

    after selecting PRIMARY KEY when you create table, don't input any value in pop dialog

    0 讨论(0)
  • 2020-11-30 07:09

    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.

    0 讨论(0)
  • 2020-11-30 07:21

    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.

    0 讨论(0)
提交回复
热议问题