SQL错误1064无法创建表

时间:2013-10-28 14:28:44

标签: mysql sql key create-table

这是确切的代码

CREATE TABLE students
(
    ID int(11),
    name varchar(45),
    lname varchar(45),
    birth date,
    PRIMARY KEY (ID)
);
CREATE TABLE schools
(
    ID int(11),
    name varchar(35),
    PRIMARY KEY (ID)
);
CREATE TABLE courses
(
    ID char(7),
    name varchar(45),
    credits tinyint(4),
    school int(11),
    PRIMARY KEY (ID),
    FOREIGN KEY (school) REFERENCES schools(ID)
):
CREATE TABLE enrollment
(
    ID int(11),
    edate date,
    estart date,
    course char(7),
    studentid int(11),
    PRIMARY KEY (ID),
    FOREIGN KEY (studentid) REFERENCES students(ID),
    FOREIGN KEY (course) REFERENCES courses(ID)
);

它通过学生和学校没有问题,但当它到达课程表时,它会停止

  

MySQL说:文档

     

#1064 - 您的SQL语法出错;检查与MySQL服务器版本对应的手册,以获得正确的语法   '附近':CREATE TABLE enrollment(       ID int(11),       编辑日期,       estart日期,       第9行的'cours'

1 个答案:

答案 0 :(得分:3)

将冒号':'变为分号';'