0

我已经搜索过,但令人沮丧的是,我无法弄清楚为什么我在以下 SQL 语句中收到此错误。

错误:#1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 5 行的 ''kidney_renal_dialysis' enum('Yes','UnderTreat','No','Ref') not NULL, 'liver_c' 附近使用正确的语法

SQL 语句:>

CREATE TABLE `client_health_info` (
  `client_id` int(11) NOT NULL PRIMARY KEY,
  `ER_visits_3_months` int(2) NOT NULL,
  `hospitilizations_last_year` int(2) NOT NULL,
  'kidney_renal_dialysis' enum('Yes','UnderTreat','No','Ref') not NULL,
  'liver_cirr_ES_liver' enum('Yes','UnderTreat','No','Ref') not NULL,   
  'HCAH' enum('Yes','UnderTreat','No','Ref') not NULL,
  'hiv_aids' enum('Yes','UnderTreat','No','Ref') not NULL,
  PRIMARY KEY (`client_id`)
  ) ENGINE=InnoDB not CHARSET=latin1;
4

1 回答 1

1

您使用了错误的引号!;-)

CREATE TABLE `client_health_info` (
  `client_id` int(11) NOT NULL PRIMARY KEY,
  `ER_visits_3_months` int(2) NOT NULL,
  `hospitilizations_last_year` int(2) NOT NULL,
  `kidney_renal_dialysis` enum('Yes','UnderTreat','No','Ref') not NULL,
  `liver_cirr_ES_liver` enum('Yes','UnderTreat','No','Ref') not NULL,   
  `HCAH` enum('Yes','UnderTreat','No','Ref') not NULL,
  `hiv_aids` enum('Yes','UnderTreat','No','Ref') not NULL
) ENGINE=InnoDB, CHARSET=latin1;

编辑:修复了另外两个错误:重复PRIMARY KEY语句和NOT之前的CHARSET.

于 2012-10-08T00:03:36.767 回答