samedi 20 décembre 2014

Why storing product fees in another table is preferred?


MySql: What is the benefit of storing several types of fees in another table like



Product Table -> (productid...),
ProductFee Table -> (productid, feetypeid, feeamount),
ProductFeeType -> (feetypeid, feetitle)


over


Product Table -> (productid, feeXamount, feeYamount, feeZamount) ?


The former would require too many joins and when updating the prouct page, it would require too many inserts. What would be the benefit of such structure? The former seems to be preferred approach. Obviously, if the number of types of fee amounts start to go crazy like 40-50, it's best to follow the latter approach. However, if it's only 5-10 and database-size is not something to fret about, then why .. especially when you're not writing a generic CMS like WordPress but a custom-tailored CMS?





Aucun commentaire:

Enregistrer un commentaire