-2

We're trying to come up with the data model of Payment Method. There can be several kinds of payment methods like Card, Bank Transfer, Wallet, which further can be categorized for e.g. Card into credit/debit cards, Bank Transfer into ACH/SEPA and the like.

So this is about modelling inheritance into database tables. One option is to use single table inheritance. Senior folks in my team call single table as denormalized table. But I don't understand why? I don't see any insert/delete/update anomalies here, each payment method record is independent in its own, there are no redundancies. It's just there will be lots of nulls in the table as set of columns will be union of all payment methods.

philipxy
  • 14,867
  • 6
  • 39
  • 83
victini
  • 193
  • 1
  • 6
  • 1
    What single table? Show the "normalized" & the "denormalized". – philipxy Nov 19 '18 at 07:59
  • Single table is the table used to store all types of payment methods. – victini Nov 19 '18 at 08:11
  • 1
    I know that. Give exact details if you want a detailed answer. Right now we can just try to guess what general sort of thing you mean. See my answer from the current level of detail in your question. – philipxy Nov 19 '18 at 08:51
  • What details do you want? Do you want exact field information? – victini Nov 19 '18 at 09:00
  • 1
    Why do you think that "use single table inheritance" & "there will be lots of nulls in the table as set of columns will be union of all payment methods" tells us what you are doing? That's all you've said other than saying you have subtypes. Just because you chose that phrase or saw it used to describe a pattern doesn't mean we all use it for that or that everyone would use it to mean what you mean by it. Nevertheless I addressed what seems likely to be your meaning in my answer. So do you or do you not need a more specific answer than that? "Give exact details if you want a detailed answer." – philipxy Nov 19 '18 at 11:29

1 Answers1

1

You are probably right. Typically a supertype table with nulls is the left join of a common-attribute table & some subtype tables. (A union of joins.) But normalization losslessly decomposes to projections & denormalization undoes that via natural join. So here the rearrangement to smaller tables is probably not normalization & is not done for the reasons we normalize & recombining is probably not denormalization. So "denormalized" & "normalized" are misused. Still--even if they use the wrong word there can still be a problem. Why don't you ask them what they mean?

philipxy
  • 14,867
  • 6
  • 39
  • 83