我已经搜索过,但令人沮丧的是我无法弄清楚为什么我在以下SQL语句中收到此错误。
错误:#1064 - 您的SQL语法出错;检查与您的MySQL服务器版本相对应的手册,以便在''kidney_renal_dialysis'enum('Yes','UnderTreat','No','Ref')附近使用正确的语法,而不是NULL,'liver_c'在第5行
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;
答案 0 :(得分: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
。