我正在尝试在mySQL中对可选的自相关性进行建模,例如,一门课程可能具有一个或多个先决条件,而这些前提是同一张表中的其他课程。
Have a separate table which lists the course's prerequisites:
create table class_prerequisite (
classID int not null,
prerequisiteClass int not null,
required bit not null default false,
primary key (classID, prerequisiteClass)
);
where classID and prerequisiteClass are foreign keys pointing back at your classes table. The 'required' field would signal if it's a mandatory or optional prereq.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.