It should be based on logic. You should be able to express constraints in natural language. ERDs are great only if you already grok how to automatically verbalize diagrams. If not yet, then use plain text editor, it is better and more powerful than ERD.
For this example, starting with two predicates
- Course type TYP exists.
ctype {TYP}
- Course CRS exists.
course {CRS}
here are a few options based on constraints:
For each course, that course is of exactly one course type;
for each course type, more than one course may be of that type.
ctype {TYP}
PK {TYP}
course {CRS, TYP}
PK {CRS}
FK {TYP} REFERENCES ctype {TYP}
For each course, that course may be of more than one course type;
for each course type, exactly one course is of that type.
ctype {TYP, CRS}
PK {TYP}
FK {CRS} REFERENCES course {CRS}
course {CRS}
PK {CRS}
For each course, that course is of exactly one course type;
for each course type, exactly one course is of that type.
course {CRS, TYP}
PK {CRS}
AK {TYP}
For each course, that course is of at most one course type;
for each course type, more than one course may be of that type.
ctype {TYP}
PK {TYP}
course {CRS}
PK {CRS}
course_ctype {CRS, TYP}
PK {CRS}
FK1 {CRS} REFERENCES course {CRS}
FK2 {TYP} REFERENCES ctype {TYP}
For each course, that course may be of more than one course type;
for each course type, more than one course may be of that type.
ctype {TYP}
PK {TYP}
course {CRS}
PK {CRS}
course_ctype {CRS, TYP}
PK {CRS, TYP}
FK1 {CRS} REFERENCES course {CRS}
FK2 {TYP} REFERENCES ctype {TYP}
For each course, that course may be of more than one course type;
for each course type, at most one course is of that type.
ctype {TYP}
PK {TYP}
course {CRS}
PK {CRS}
course_ctype {CRS, TYP}
PK {TYP}
FK1 {CRS} REFERENCES course {CRS}
FK2 {TYP} REFERENCES ctype {TYP}
For each course, that course is of at most one course type;
for each course type, at most one course is of that type.
ctype {TYP}
PK {TYP}
course {CRS}
PK {CRS}
course_ctype {CRS, TYP}
PK {CRS}
AK {TYP}
FK1 {CRS} REFERENCES course {CRS}
FK2 {TYP} REFERENCES ctype {TYP}
Note:
All attributes (columns) NOT NULL
PK = Primary Key
AK = Alternate Key (Unique)
FK = Foreign Key
In general, the constraint is verbalized as:
For each A, that A {is | may be}
of {exactly one | more than one | at most one}
B;
for each B, {exactly one | more than one | at most one}
A {is | may be}
of that B.
Term Range
---------------------------------
is of exactly one [1]
is of at most one [0,1]
may be of more than one [0,*]