ERDs are great if you already grok how to automatically verbalize diagrams. When in doubt use plain text: predicates, constraints, relations. Better and more powerful than ERDs.
-- Project PRO exists.
--
project {PRO}
PK {PRO}
-- Employee EMP exists.
--
employee {EMP}
PK {EMP}
-- Skill SKL exists.
--
skill {SKL}
PK {SKL}
-- Employee EMP has skill SKL.
--
emp_skl {EMP, SKL}
PK {EMP, SKL}
FK1 {EMP} REFERENCES employee {EMP}
FK2 {SKL} REFERENCES skill {SKL}
-- Project PRO requires skill SKL.
--
pro_skl {PRO, SKL}
PK {PRO, SKL}
FK1 {PRO} REFERENCES project {PRO}
FK2 {SKL} REFERENCES skill {SKL}
-- Employee EMP with skill SKL, is assigned
-- to project PRO, that requires that skill.
--
emp_pro {EMP, PRO, SKL}
PK {EMP, PRO}
FK1 {EMP, SKL} REFERENCES emp_skl {EMP, SKL}
FK2 {PRO, SKL} REFERENCES pro_skl {PRO, SKL}
Note:
All attributes (columns) NOT NULL
PK = Primary Key
FK = Foreign Key
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…