5 mysql sql unique primary-key unique-constraint
我正在尝试创建一个名为Students的表,只有一个字段student_name.
student_name应该是VARCHAR和主键,因为我想通过他们的名字唯一地标识学生.
CREATE TABLE 'swinters'.'Students' (
'student_name' VARCHAR NOT NULL,
PRIMARY KEY ('student_name')
)
ENGINE = InnoDB;
Run Code Online (Sandbox Code Playgroud)
MYSQL Error Number 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 'NOT NULL, PRIMARY KEY ('student_name') ) ENGINE = InnoDB' at line 2.
MYSQL Error Number 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 'NOT NULL, PRIMARY KEY ('student_name') ) ENGINE = InnoDB' at line 2.
MYSQL Error Number 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 'NOT NULL, PRIMARY KEY ('student_name') ) ENGINE = InnoDB' at line 2.