This may be a rather naive question and I am not even sure if I am asking it in the best way, so my apologies if not.
I would like to know if there is a standard, or best way to handle cases where you have multiple types of the same object, each of which have some differing properties.
For example, - payments. All payments have some properties in common (status, value, date received etc.) but some properties will depend upon the specific type of payment. e.g. cheques will have a bank, cheque number etc. Where as Paypal payments will have a Transaction ID etc.
I can see two ways of handling this, and neither seem ideal (although I might be wrong and there are probably other ways I have not thought of).
The first and simplest way would be to have a single "Payments" table with all the fields in it, and simply have NULL values for the fields which do not apply.
The second way would be to have a "Payments" table to contain all the generic payment details and then another table for each of payment types to how the type specific details.
Please see the image below for visual examples:
Is there a "correct" way to handle this type of situation? Also, should I be storing the "Payment Type" as a field, or calculating it based on the other data?
Any suggestions or advise would be gratefully received.