2017-09-23 87 views

回答

1

在數據庫設計中,沒有繼承概念。我們通過外鍵實現了IS-A(繼承)和HAS-A(組合)。

例如:汽車有引擎 汽車表引用引擎表與外鍵。

例如:學生是一個人 學生表是指具有foregin關鍵

現在,你想達到什麼是學生應該是一個工人的人表。

它很簡單。基本上學生是一個人。所以那個特定的人也可以成爲一名工人。

enter image description here

enter image description here

一個人既可以是學生和工人,滿足您的要求。

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.