1

I have to design a database which will allow me store data in multiple languages. I came up with something like this.


create table lang ( id primary key, lang_code )
create table data (id primary key)
create table i18n_data (id primary key, i18n_text ,data_id references data, lang_id references lang)

Is creating a table with only one column/primary key is an overkill for my requirement? Is there any better way to do it?

Thanks.

Naveed Quadri
  • 498
  • 5
  • 18

2 Answers2

0

On the top of my head I see two similar options:

Having just two tables lang and i18n_data and an indexed field in i18n_data that you use with the language to index the translation.

Another option could be to use a composed primary key on the i18n_data table that has the reference to lang and the data identifier.

pconcepcion
  • 5,591
  • 5
  • 35
  • 53
0

I think that your solution is a quite nice one, I am solving such problems the same way. And I wouldn't fear to create a table only with a primary key (although you might find a few attributes which are belonging to this table).

Daniel Rotter
  • 1,998
  • 2
  • 16
  • 33