展开无限ERD

发布于 2024-11-06 11:38:13 字数 272 浏览 0 评论 0原文

我有一个学校作业的 erd,其中包含多对多关系,据我所知,这是不可扩展的。我有一堂课可以由许多老师授课(就像许多老师在同一个房间同时教同一个人),并且指定一名老师作为班主任,所以据我所知,一个班级可以由多名教师授课,并且多名教师可以(同时)教授同一班级。有谁知道我如何扩展这个?

我尝试过制作一周的实体,例如小组。所以一堂课由一组教,一组可以教很多课,但我仍然遇到一个组可以有很多老师并且很多老师可以在一个组中的问题。 从每个角度来看,我最终都会在老师与班级或弱实体之间建立多对多的关系,任何帮助将不胜感激。 谢谢

i have an erd for a school assignment that contains a many to many relationship that as far as i can tell is un-expandable. I have a class that can be taught by many teachers (as in many teachers in the same room at the same time teaching the same people) and one teacher is assigned as the head teacher, so as far as i can see, one class can be taught by many teachers and many teachers can teach the same class (at the same time). Has anyone got any idea how i could expand this?

I have tried making a week entity eg group. so one class is taugt by one group and one group can teach many classes but i still end up with the issue of one group can have many teachers and many teachers can be in a group.
Every way i look at i end up with a many to many relationship between teacher and either class or the weak entity, any help would be greatly appreciated.
thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

记忆里有你的影子 2024-11-13 11:38:13

建模 m:n 关系的常用(也是最好)方法是创建中间关联。

在这种情况下,班级和关联之间将具有 1:m 关系(因为每个班级可以与许多教师关联),而教师和关联之间也会有 1:m 关系(因为每个教师可以与许多班级关联)。

在创建表时,关联本身就成为一个表,具有 Class 和 Teacher 的外键,从而将它们链接在一起。

The usual (and best) approach to modeling m:n relationships is to create an intermediate association.

In this case you would have a 1:m relationship between Class and the association (since each class can be associated with many teachers) and also a 1:m relationship between Teacher and the associtaion (since each teacher can be associated many classes).

When it comes to creating tables, the association becomes a table in its own right, with foreign keys to both Class and Teacher, thus linking them together.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文