Skip to content
Advertisement

MySQL error #1064 on create table with DOUBLE column

I’m struggling to code this table as it’s giving me a #1064 error, and this corresponds to a few potential issues. If someone could point out where I’ve made a mistake that would be great.

Here is an image of the code I’ve typed, and the error I’ve received:

Create table and error 1064

The code:

CREATE TABLE `RENRMyLUoX`.`movie`(
    `mID` INT(20) NOT NULL,
    `title` VARCHAR(50) NULL DEFAULT NULL,
    `relYear` YEAR(4) NULL DEFAULT NULL,
    `category` VARCHAR(50) NULL DEFAULT NULL,
    `runTime` INT(20) NOT NULL,
    `studioName` VARCHAR(50) NULL DEFAULT NULL,
    `description` VARCHAR(50) NULL DEFAULT NULL,
    `rating` DOUBLE(20) NULL DEFAULT NULL,
    PRIMARY KEY(`mID`(20))
) ENGINE = InnoDB CHARSET = latin1 COLLATE latin1_bin;

Advertisement

Answer

The DOUBLE datatype should be specified as either DOUBLE or DOUBLE(m, d). I don’t understand what (20) is supposed to do… you can simply omit it:

rating DOUBLE NULL DEFAULT NULL,
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement