I have database to be designed about people info
there will be some common details about people like name,age,address,contact etc…
but there are categories of people like government servants,business man,salaried , politicians etc…
so there will be some dynamic fields about the categories…
common details table can be made easily but the problem is with dynamic fields of categories like
government servants will have income, dept, since,etc…
I have created three tables :
Peoples Table: name, age, DOB, etc…
Category:rows for Government servants, salaried etc…
Attributes:
------------------------
ID|Category|Field|Value
-----------------------
1 |GS |dept |electricity
the above database design (what i am using now) is kind of
NopCommerce database deign with
Nop_Customer and Nop_CustomerAttribute table
so is this a good one or anything better than this could be done: (for this situation)
Two imp points to be considered:
1-users will add data for this so controls will have to be created accordingly
2- this database will be searched by others.
EDIT:
The fields for each Category will be fixed.
but the categories will be added over time not by users but by developers, so need it be less hectic and maintainable for developers
Make tables for each type of person. In those tables, only store what is applicable. If Phil Jones is a politician, then he would have an entry in the Person table that describes him as far as a person is concerned. He would also have a row in the Politicians table that would describe him as far as a politician is concerned. Make each of the child tables have a foreign key relationship with the person table’s ID column.