I have a table with products and their descriptions in several languages. For now the table structure is like this
tblProducts
productId INT PK AI
productDesc_en VARCHAR
productDesc_de VARCHAR
productDesc_it VARCHAR
and so on. Where en is for English, de is for German
So visitor according to his language setting, sees description on his language.
Just wondering, are there any benefits in storing data like this instead?
tblProducts
productId INT PK AI
tblProductDesc_en
descId INT PK AI
tblProducts_productId INT FK
description VARCHAR
tblProductDesc_de
descId INT PK AI
tblProducts_productId INT FK
description VARCHAR
tblProductDesc_it
descId INT PK AI
tblProducts_productId INT FK
description VARCHAR
The pro(s) i see in this solution:
- Easier to maintain from DB perspective
- Less memory used when instantiating object from DB record (since only required language will be stored within an object)
The con(s):
- Will have to use JOIN(s) to fetch required data which may hit performance;
- More complicated getters and setters from within a class
Anything else?
Thank you!