database - UML : Optional Foreign Key -


i'm sitting little headache problem right now.

i have 2 entities payment order , account

payment order pk - id fk - debited acc fk - credited acc   account pk - accountnumber 

i struggle find logic when credited account not account financial institution. can not foreign key anymore since account not contained within account table.

have guys idea workaround?

edit

question : have change constraint on credited acc nothing ? or can keep way is?

i recommend make account table contain more accountnumber column.

if toy example, add boolean indicate whether account number internal versus external. if going operational system, consider adding financial_institution table , use primary key foreign key in accountnumber table.


Comments