2

I'm going back and forth on whether or not to have three tables, or one, with nullable columns.

In a business sense, I have 'Accounts'. An account can be either a Bank Account, or a Third Party.

But they're all treated as accounts. I can pay money from one account, to another.

A Bank Account has fields like "Opening Balance", and "BankAccountType: {Savings, Credit, Debit}". As well as a few other specific columns.

A Third Party account has fields like "IsAPerson", for example, plus a load of other columns.

If I had one account table, I'd have a lot of nullable columns, as some fields are not applicable to both types.

I'm leaning towards an Account table, with common fields, a ThirdParty table, which has fields for Third Parties, and a BankAccount table, with it's specific fields.

Account would have an AccountTypeId. To get all BankAcounts, it's an Inner Join (Account -> BankAccount) To get all ThirdParties, it's an Inner Join (Account -> ThirdParty)

This feels cleaner. As far as data integrity goes, I COULD have an issue where a Account.AccountTypeId = ThirdParty, but a missing ThirdParty row, but I guess I just need to make sure that doesn't happen.

Which approach is better? One table with nullable columns? Or three tables?