Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
255 views
in Technique[技术] by (71.8m points)

database - Does single table inheritance results in denormalization

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

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

1 Reply

0 votes
by (71.8m points)

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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...