Im trying to create a table and this error keeps popping:
"#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') NOT NULL,
urlVARCHAR(500) CHARACTER SET utf8 COLLATE utf8_general_ci N' at line 2"
My code:
CREATE TABLE `stema`.`products`(
`code` DOUBLE(10) NOT NULL,
`url` VARCHAR(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
`product_name` VARCHAR(100) NULL,
`generic_name` VARCHAR(100) NULL,
`quantity` VARCHAR(50) NULL,
`packaging` VARCHAR(100) NULL,
`brands` VARCHAR(50) NULL,
`categories` VARCHAR(100) NULL,
`countries` VARCHAR(50) NULL,
`ingredients_text` VARCHAR(200) NULL,
`allergens` VARCHAR(100) NULL,
`traces` VARCHAR(100) NULL,
`serving_size` VARCHAR(100) NULL,
`serving_quantity` INT(10) NULL,
`additives_n` INT(10) NULL,
`additives_tags` VARCHAR(100) NULL,
`nutriscore_score` INT(10) NULL,
`nutriscore_grade` VARCHAR(10) NULL,
`nova_group` VARCHAR(10) NULL,
`pnns_groups_1` VARCHAR(100) NULL,
`pnns_groups_2` VARCHAR(100) NULL,
`main_category` VARCHAR(100) NULL,
`image_url` VARCHAR(500) NULL,
`image_small_url` VARCHAR(500) NULL,
`image_front_url` VARCHAR(500) NULL,
`energy-kj_100g` DOUBLE(10) NULL,
`energy-kcal_100g` DOUBLE(10) NULL,
`energy_100g` DOUBLE(10) NULL,
`fat_100g` DOUBLE(10) NULL,
`saturated-fat_100g` DOUBLE(10) NULL,
`sugars_100g` DOUBLE(10) NULL,
`salt_100g` DOUBLE(10) NULL,
`sodium_100g` DOUBLE(10) NULL,
PRIMARY KEY(`code`)
);
double(10)were allowed, you would never have a floating point number be a primary key on a table. - Gordon Linoff