我使用MySQL
5.6命令行客戶端創建一個簡單的數據庫,我可以創建數據庫還沒有創建我的第一個表我有一個我無法識別的語法錯誤。感謝您的幫助,如果有英文錯誤,我不好意思,它不是我的第一語言。 請找到粘貼在SQL
語法錯誤:創建表時SQL語法錯誤
mysql> USE SYLVAINTEST
Database changed
mysql> CREATE TABLE students
-> (
-> studentid INT NOT NULL,
-> firstname VARCHAR,
-> lastname VARCHAR,
-> dob VARCHAR,
-> CONSTRAINT pk_students PRIMARY KEY (studentid)
-> );
ERROR 1064 (42000): 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 ' lastname VARCHAR, dob VARCHAR, CONSTRAINT pk_students ' at line 4
mysql> CREATE TABLE students
-> (
-> studentid INT NOT NULL,
-> firstname VARCHAR ,
-> lastname VARCHAR ,
-> dob VARCHAR ,
-> CONSTRAINT pk_students PRIMARY KEY (studentid)
-> );
ERROR 1064 (42000): 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 ' lastname VARCHAR , dob VARCHAR , CONSTRAINT pk_students PRIMARY KEY (' at line 4
嘗試包括帶長'VARCHAR()'一兩件事。另外,如果'dob'用於「出生日期」,那應該是日期而不是字符串。 –