我不确定我在这里做错了什么,但我收到一个错误:
Error Code: 1005. Can't create table 'erm.section' (emo:150)
这是代码。“课程”表已成功创建。我尝试在“section”表中修改 course_number attritube 的名称,但这没有用。
USE erm;
CREATE TABLE course
(
course_name VARCHAR(30) NOT NULL,
course_number VARCHAR(20) NOT NULL,
credit_hours INT NOT NULL,
department VARCHAR(10),
CONSTRAINT course_pk PRIMARY KEY (course_name)
);
CREATE TABLE section
(
section_identifier INT NOT NULL,
course_number VARCHAR(20),
semester VARCHAR(10) NOT NULL,
school_year VARCHAR(4) NOT NULL,
instructor VARCHAR(25),
CONSTRAINT section_pk PRIMARY KEY (section_identifier),
CONSTRAINT section_fk FOREIGN KEY (course_number)
REFERENCES course (course_number)
ON DELETE SET NULL
ON UPDATE CASCADE
);