Dynamic Fields/Columns
Posted
by
DanMark
on Programmers
See other posts from Programmers
or by DanMark
Published on 2012-07-09T17:56:01Z
Indexed on
2012/07/09
21:22 UTC
Read the original article
Hit count: 205
What is the best way to allow for dynamic fields/database columns? For example, let's say we have a payroll system that allows a user to create unique salary structures for each employee. How could/should one handle this scenario? I thought of using a "salary" table that hold the salary component fields and joining these columns to a "salary_values" table that hold the actual values. Does this make sense?
Example Salary Structures:
Notice how the components of the salary can be shared or unique.
-- Jon's Salary --
Basic 100
Annual Bonus 25
Tel. Allowances 15
-- Jane's Salary --
Basic 100
Travel Allowances 10
Bi-annual Bonus 30
© Programmers or respective owner