This question has popped up a couple of times, but I'm still not 100% on how it works.
I'm creating some tables for bank infrastructure. This bank provides services to a company. There are groups that exist within the company that can access some or all of these services, depending on permissions. But there are also groups within the bank, that have no relation to the company, that can access these services.
My group table, has an Group_ID(PK), and Company_ID and Bank_ID as (FK). Is it OK for these FKs to be null, depending on whether the group is company group or a bank group?
Nullable foreign keys are fine (at least in SQL Server, not sure about all RDBMSes). It just means the column can be null, but if it's not, then it needs to meet the constraint.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With