如何在 mySQL 中建模可选的自相关性?
我正在尝试在 mySQL 中对可选的自相关性进行建模,其中例如一门课程可能有一个或多个先决条件,这些先决条件是同一个表中的其他课程。
I'm trying to model optional self dependence in mySQL wherein for instance a course may have one or more prerequisite(s) which are other courses in the same table.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一个单独的表,其中列出了课程的先决条件:
其中 classID 和先决条件Class 是指向您的课程表的外键。 “必需”字段将表明它是强制性的还是可选的先决条件。
Have a separate table which lists the course's prerequisites:
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.