Sunday, 15 April 2012

sql - Improving a DB design where a prefix designates a relation -



sql - Improving a DB design where a prefix designates a relation -

i’m rewriting old accounting system, , i’ve found database design suspect quite poor. don’t have particularly much experience database design, can’t sure.

in old scheme there transactions table, , every row in table has foreign key table determined prefix. example:

| id | voucher | | 1 | l-100801 | | 2 | u-120407 | | 3 | z-622909 |

there more 2 columns in table (about 15 actually). if row’s voucher begins l, it’s connected client invoices table. if begins u, it’s connected payments table, etc.

am right in thinking poor design? how can improve on it? should each type separated own column? should there table voucher types utilize connecting records through?

am right in thinking poor design?

yes, poor database design. have had seen similar design @ company have worked before. makes hard query database based on table.

should each type separated own column?

it depends on entries in tables, if every id connected client invoice, payments , other tables , less complex approach. based on sample info not right approach.

should there table voucher types utilize connecting records through?

this improve way go ahead similar tackling many many association creating association table represent association. way company worked @ redesigned database.

sql database-design

No comments:

Post a Comment