1đź‘Ť
âś…
Any many-to-many relationship, not just in Django, requires a linking table.
You say “I can identify a doctor by its id and match it with the id of the health plan” – well, that’s exactly what the linking table does. Where else would that data go? As you say, each doctor has many plans, and each plan has many doctors. So there’s no way to store that data on either the doctor’s side, or the plan’s side, since you need many entries. The linking table achieves that, by having many entries for each doctor, and many entries for each plan, but only one for each combination of doctor+plan.
👤Daniel Roseman
Source:stackexchange.com