#1064 - 您的SQL语法有错误;

时间:2014-04-23 13:09:11

标签: mysql

我一直在尝试在mySQL 5.6上创建下表

CREATE TABLE customers
 (
 id INTEGER NOT NULL auto_increment,
 cust_first_name VARCHAR (30) NOT NULL,
 cust_last_name VARCHAR (30) NOT NULL,
 cust_address VARCHAR (30),
 cust_dob DATE,
 cust_anniversary DATE,
 cust_phone1 INTEGER(10) NOT NULL,
 cust_phone2 INTEGER(10),
 cust_phone3 INTEGER(10),
 cust_fax INTEGER(10),
 cust_email VARCHAR,
 cust_PW VARCHAR(10) NOT NULL,
 cust_suburb VARCHAR(20),
 cust_postcode VARCHAR(4),
 cust_state VARCHAR (3),
 cust_gender CHAR(1) NOT NULL,
 cust_type VARCHAR(5) NOT NULL, 
 companies_id INTEGER NOT NULL,
 employees_id INTEGER NOT NULL,
 PRIMARY KEY (id),
 CONSTRAINT com_cust_FK FOREIGN KEY (companies_id) REFERENCES companies(id),
 CONSTRAINT emp_cust_FK FOREIGN KEY (employees_id) REFERENCES employees(id),
 CHECK (cust_gender IN('M','F')),
 CHECK (cust_type IN(‘Gold’,’Silver’,’Bronze’)
 );

我收到以下错误:#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 ' cust_Password VARCHAR(10) NOT NULL, cust_suburb VARCHAR(20), cust_postcod' at line 13

我怎样才能克服这个?

1 个答案:

答案 0 :(得分:1)

VARCHAR(150)字段大小提到cust_email字段