I have the following situation in a database of equipment I am trying to design. I currently have 3 tables detailing 3 different types of equipment and 1 table to keep all the ids unique across all 3 tables. As follows:
CREATE TABLE EQUIPMENT
(
/*Primary key*/
EQUIPMENT_ID VARCHAR(30),
PRIMARY KEY (EQUIPMENT_ID)
);
CREATE TABLE PIPING
(
/*Primary key*/
EQUIPMENT_ID VARCHAR(30),
/*Generic Fields*/
STATUS VARCHAR(1),
INSPECTION_STATUS VARCHAR(1),
REMEDIATION_STATUS VARCHAR(1),
/*Specific properties for piping equipment*/
OUTSIDE_DIAMETER FLOAT,
WALL_THICKNESS FLOAT,
/*About another additional 50 specific fields*/
PRIMARY KEY (EQUIPMENT_ID),
FOREIGN KEY (EQUIPMENT_ID) REFERENCES EQUIPMENT(EQUIPMENT_ID)
);
CREATE TABLE VESSELS
(
/*Primary key*/
EQUIPMENT_ID VARCHAR(30),
/*Generic Fields*/
STATUS VARCHAR(1),
INSPECTION_STATUS VARCHAR(1),
REMEDIATION_STATUS VARCHAR(1),
/*Specific properties for vessel equipment*/
DISHED_END_THICKNESS FLOAT,
DESIGN_CODE VARCHAR(25),
/*About another additional 50 specific fields*/
PRIMARY KEY (EQUIPMENT_ID),
FOREIGN KEY (EQUIPMENT_ID) REFERENCES EQUIPMENT(EQUIPMENT_ID)
);
CREATE TABLE TANKS
(
/*Primary key*/
EQUIPMENT_ID VARCHAR(30),
/*Generic Fields*/
STATUS VARCHAR(1),
INSPECTION_STATUS VARCHAR(1),
REMEDIATION_STATUS VARCHAR(1),
/*Specific properties for tank equipment*/
FLOATING_ROOF_DIAMETER FLOAT,
FLOATING_ROOF_THICKNESS FLOAT,
/*About another additional 50 specific fields*/
PRIMARY KEY (EQUIPMENT_ID),
FOREIGN KEY (EQUIPMENT_ID) REFERENCES EQUIPMENT(EQUIPMENT_ID)
);
Is it better to combine all of these tables into one master equipment table with 150 columns? Or leave them separated out in their groups keeping in mind the following:
- All fields in the piping, vessels and tanks tables have a 1:1 relationship with and are all dependent on the primary key.
From referring to other posts on the stackoverflow community on this subject...
MySQL: multiple tables or one table with many columns?
It would appear that the best design for this scenario would be one large table with many columns due to the 1:1 relationship between the primary key and the columns but I am not yet convinced and would like someone else's thoughts on the matter.