我想設定一個資料表 但是一直都不給過
想請問怎麼解決
SQL
CREATE TABLE `new_db`.`news` ( `id` TINYINT(4) UNSIGNED NOT NULL AUTO_INCREMENT , `title` VARCHAR(100) CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL , `content` VARCHAR(255) CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL , `time` DATE NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;
錯誤碼
#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 '=utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL , `content` VARCHAR(255) ' at line 1
CREATE TABLE `new_db`.`news` ( `id` TINYINT(4) UNSIGNED NOT NULL AUTO_INCREMENT , `title` VARCHAR(100) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL , `content` VARCHAR(255) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL , `time` DATE NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;
不是charset xxxx,是character set xxxx啦。
請參閱:http://dev.mysql.com/doc/refman/5.7/en/create-table.html 裡面關於data_type的語法。