Skip to main content
deleted 8 characters in body
Source Link
Rick James
  • 79.4k
  • 5
  • 51
  • 117

It will work. But I recommend changing the names, datatypes and indexing:

create table options_table (
    grouping`type`   VARCHAR(20) NOT NULL,           -- keep it short
    key    `value`  VARCHAR(20) UNSIGNED NOT NULL,       -- keep it short
    description VARCHAR(999) NOT NULL,
    PRIMARY KEY(type, value)   -- probably the only index needed
) ENGINE=InnoDB;

I did something like that once in 30 years. I used description to make some web pages more user-friendly.

One table (and 2-column JOIN) versus many tables (and 1-column JOINs) -- very little performance difference.

See also ENUM and SET and FIND_IN_SET().

It will work. But I recommend changing the names, datatypes and indexing:

create table options_table (
    grouping VARCHAR(20) NOT NULL,           -- keep it short
    key      VARCHAR(20) UNSIGNED NOT NULL,  -- keep it short
    description VARCHAR(999) NOT NULL,
    PRIMARY KEY(type, value)   -- probably the only index needed
) ENGINE=InnoDB;

I did something like that once in 30 years. I used description to make some web pages more user-friendly.

One table (and 2-column JOIN) versus many tables (and 1-column JOINs) -- very little performance difference.

See also ENUM and SET and FIND_IN_SET().

It will work. But I recommend changing the names, datatypes and indexing:

create table options_table (
    `type`   VARCHAR(20) NOT NULL,       -- keep it short
    `value`  VARCHAR(20) NOT NULL,       -- keep it short
    description VARCHAR(999) NOT NULL,
    PRIMARY KEY(type, value)   -- probably the only index needed
) ENGINE=InnoDB;

I did something like that once in 30 years. I used description to make some web pages more user-friendly.

One table (and 2-column JOIN) versus many tables (and 1-column JOINs) -- very little performance difference.

See also ENUM and SET and FIND_IN_SET().

Source Link
Rick James
  • 79.4k
  • 5
  • 51
  • 117

It will work. But I recommend changing the names, datatypes and indexing:

create table options_table (
    grouping VARCHAR(20) NOT NULL,           -- keep it short
    key      VARCHAR(20) UNSIGNED NOT NULL,  -- keep it short
    description VARCHAR(999) NOT NULL,
    PRIMARY KEY(type, value)   -- probably the only index needed
) ENGINE=InnoDB;

I did something like that once in 30 years. I used description to make some web pages more user-friendly.

One table (and 2-column JOIN) versus many tables (and 1-column JOINs) -- very little performance difference.

See also ENUM and SET and FIND_IN_SET().