When is it better for normalization to put data of these tables into a single one and use another to differentiate what group the values belong to?
The following tables populate dropdowns in a web app.
CREATE TABLE request_types(
id INT AUTO_INCREMENT PRIMARY KEY,
name as varchar(32) NOT NULL
);
CREATE TABLE citizenship_types(
id INT AUTO_INCREMENT PRIMARY KEY,
name as varchar(32) NOT NULL
);
CREATE TABLE designation_types(
id INT AUTO_INCREMENT PRIMARY KEY,
name as varchar(32) NOT NULL
);
The design of all 3 is identical.
When is it better for normalization to put data of these tables into a single one and use another to differentiate what group the values belong to?
Like
CREATE TABLE field_types(
id INT AUTO_INCREMENT PRIMARY KEY,
name as varchar(32) NOT NULL,
category TINYINT NOT NULL
)
CREATE TABLE category_types(
id INT AUTO_INCREMENT PRIMARY KEY,
name as varchar(32) NOT NULL
)
with category_types populated like
{
1:"request",
2:"citizenship",
3:"designation"
}