Efficiently storing different type of orders for a client entity [database schema] -
i've design database i've client entity , client can place multiple type of orders (all differ each other, few fields common among them status, pricing, time etc). example, can place order-a, order-c, order-f (from different forms). i'm confused how cater different type of orders.
this i've created far.

now i'm confused how cater fields aren't common among order types. should create separate tables each order type save different values? , add foreign key of tables order table? complex. whats best way this?
the purist should create separate table each type of order, fields relevant order type. if there fields common order types, these should in separate, common table. tables type-specific data should point "main" order table.
the opposite alternative put fields in 1 table, , set ones not applicable given order type null.
which method choose depends on data. frankly, if have 30 fields in order record, , 1 or 2 fields apply orders, throw them in order table , let them null when not applicable.
if have many different order types , many different fields in different order types, creating separate tables can real beast. wants manage 30 order tables? gets tricky when fields in more 1 order type not all.
personally, create 1 big table fields , let null. practical. have @ nature of data , entities. if there small number of different order types , there large number of fields peculiar each, starts make sense make separate tables keep them separate. might less confusing if there aren't bunches of null fields.
Comments
Post a Comment