I want to design a database with have 2 categories. There are 2 subcategories in each category, but they are very similar to other category like:
preventive equipment maintenance:
- cat1
- id, equipment,model, series, accesories,date, cost, status
- cat 2
- id, equipment,model, series, accesories,date, cost, status
corrective equipment maintenance
- cat1
- id, new equipment, old equipment, borreowed equipment, description
- cat 2
- id, new equipment,model, series, accesories,date, cost, old equipment, borreowed equipment, description
So as you can see the only diference between data collected on preventive equipment maintenance is the cat (either cat1 or cat2). To solve this I thought to make a table like
CREATE TABLE `preventive_e`(
id INTEGER NOT NULL PRIMARY KEY,
equipment VARCHAR(25) ,
cat VARCHAR(4) ,
CONSTRAINT `uc_Info_E` UNIQUE (`id`)
);
INSERT INTO `preventive_e` values (1,'nintendo','cat1');
INSERT INTO `preventive_e` values (2,'psp','cat2');
Now in corrective it would be the same, however they are not the same fields, they are almost the same fields, if is cat1 i want to store only some fields, but if is cat 2 i want to store same fields but some more fields
Is there a way to use inheritance or something?, extending the fields but being able to add more particular fields? How would a query look like.