我是MySQL的新手,想在阅读教程后创建这个表我写了这个命令但是在MySQL Workbench上它显示了4行created_at属性的错误:
CREATE TABLE tweetMelbourne (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`geo_type` VARCHAR(8) CHARACTER SET utf8,
`created_at` DATETIME CHARACTER SET utf8 NOT NULL ,
`geo_coordinates_latitude` decimal(12,9) DEFAULT NULL,
`geo_coordinates_longitude` decimal(12,9) DEFAULT NULL,
`place_full_name` VARCHAR(35) CHARACTER SET utf8,
`place_country` VARCHAR(15) CHARACTER SET utf8,
`place_type` VARCHAR(18) CHARACTER SET utf8,
`place_bounding_box_type` VARCHAR(10) CHARACTER SET utf8,
`place_bounding_box_coordinates_NE_lat` decimal(12,9) DEFAULT NULL,
`place_bounding_box_coordinates_NE_long` decimal(12,9) DEFAULT NULL,
`place_bounding_box_coordinates_SW_lat` decimal(12,9) DEFAULT NULL,
`place_bounding_box_coordinates_SW_long` decimal(12,9) DEFAULT NULL,
`place_country_code` VARCHAR(5) CHARACTER SET utf8,
`place_name` VARCHAR(17) CHARACTER SET utf8,
`text` VARCHAR(140) CHARACTER SET utf8,
`user_id` INT,
`user_verified` VARCHAR(5) CHARACTER SET utf8,
`user_followers_count` INT,
`user_listed_count` INT,
`user_friends_count` INT,
`user_location` VARCHAR(30) CHARACTER SET utf8,
`user_following` VARCHAR(5) CHARACTER SET utf8,
`user_geo_enabled` VARCHAR(5) CHARACTER SET utf8,
`user_lang` VARCHAR(5) CHARACTER SET utf8,
PRIMARY KEY (id)
);
错误是:
Error Code: 1064. You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near 'CHARACTER SET utf8
答案 0 :(得分:0)
尝试删除'CHARACTER SET utf8'
答案 1 :(得分:0)
谢谢你们的工作。我最后使用了DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
。因此,我认为不需要为datetime定义字符集,因为它由数字组成,并且不包含字符。