There is a table named Department
, which shows the various departments of a University.
And there is a table named Branch
, which shows various branches (such as electrical, computer science, mechanical, automobile, law, literature etc.)
Conditions:
- A
Department
can have any number ofBranch
es. - A
Branch
can be associated to singleDepartment
.
It means the cardinality between Department
: Branch
is "one to many".
Now the problem is, in this kind of situation, if I make dept_id
(an attribute of table: Department
) as primary key. How would I be able to associate more than one branch_id
( an attribute of table : Branch
), because if I do it so, I may violate the primary key condition of dept_id
itself.
How to deal with cardinality and making foreign key both go hand in hand?