Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
245 views
Welcome To Ask or Share your Answers For Others

1 Answer

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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...