ER-Model:子实体可以互为模型

ER-Model: Model that child entities can be each other

我对 ER-Modells 中的继承有疑问:

给出过于简单的继承示例:

如何证明学生可以成为工人,反之亦然?

在数据库设计中,没有继承的概念。我们通过外键同时实现了 IS-A(Inheritance)和 HAS-A(Composition)。

例如:汽车有引擎 汽车 table 使用外键引用引擎 table。

例:学生是一个人 学生 table 使用外键

推荐人 table

现在,你要实现的是学生应该是工人。

很简单。基本上,学生是一个人。这样特定的人也可以 做个工人。

一个人既可以是Student也可以是Worker,满足你的要求。

If both Student and Worker are referring a same foreign key person_id i.e
That implies the person is both a Student and Worker.