CREATE TABLE college ( college_id CHAR(6) , college_name CHAR(30) , s_number INT DEFAULT 0, t_number INT DEFAULT 0), PRIMARY KEY(college_id,college_name)) > 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 ', PRIMARY KEY(college_id,college_name))' at line 5
时间: 2024-02-25 13:58:37 浏览: 86
MySQL创建数据表(CREATE TABLE语句)
这个 SQL 语句存在语法错误。错误在于逗号的位置不正确。正确的语句如下:
```
CREATE TABLE college (
college_id CHAR(6),
college_name CHAR(30),
s_number INT DEFAULT 0,
t_number INT DEFAULT 0,
PRIMARY KEY(college_id,college_name)
);
```
注意,PRIMARY KEY 应该在字段定义后面,而不是在最后一个字段后面。同时,每个字段定义之间应该使用逗号分隔。
阅读全文