1

I have got only one column for a table when i create two localized tables. Code as bellow.

-- Month
CREATE TABLE `month` (
  `id` INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
);

-- Month Localized
CREATE TABLE `month_loc` (
  `month_id'    INT NOT NULL,
  `name`        VARCHAR(200)    NOT NULL,
  `description` VARCHAR(500)    NOT NULL,
  `lang_id`     INT NOT NULL
);

month_loc.month_id is the foreign key.

Month table holds only the primary key. Other all fields should be localized. Is this table structure correct ?

Thanks.

3

Assuming that each month is universally identified by number (1 is January, 2 is February, etc.), it is useless to have a table that store the first twelve numbers, so you could have a single table, with the following attributes:

CREATE TABLE month_loc (
  month_number    INT NOT NULL,
  name            VARCHAR(200)    NOT NULL,
  description     VARCHAR(500)    NOT NULL,
  lang_id         INT NOT NULL,
  PRIMARY KEY(lang_id,month_number)
);

You could use this table to find efficiently a certain month in a certain language.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.