Sunday, March 11, 2012

Columns vs. Rows

hi,

I'm building a multi-lingual website

In my database tables I have, in some of them, a column with the Language, because some of the columns depend on what language the user wants to see the site.

My question is: what is better? have that column and consequently two row (for two languages) with repeated column information? or have two column within a row with the language specification?

e.g.

table: id, description, price

(1) With language:

id,description, price, language='EX'

id,description, price, language='EN'

vs.

(2)

id, descriptionEN,descriptionEX,price

if I have 500 products

in 1 whould result in 1000 entries

in 2 just 500 results

can anyone tell me a diference/advantage between the two approachs?

thanks in advance.

In a problem like this, I would be guided by the following:

If the number of languages is fixed (i.e. the number of columns is not expected to change), go with the second approach (each language in a different field)

In case the number of languages can increase, go with the first approach as it gives you the flexibility to add another row for every new language.

No comments:

Post a Comment