Database Design Issues

Database Design is one of the most difficult tasks in the software world. The weak design of the database can lead to problems which are extremely hard to fix. I encountered a scenario in which you have a bit field in the database which represents the status of the record. Let's say that bit field is called "Active" and Active = 1 means that the record is active else it is inactive. Now, everything works okay but what if we push in another criteria which is "pending" meaning that the record is in pending condition. This means that the record is not active and nor inactive but pending. How do you solve this task? A common approach is to introduce another column in the database which is called "IsPending". IsPending when 1 means that the record is in pending state and when 0 means the record is not in the pending state.

Another solution is to create a separate table for active value which maps to different values. Say, Active = 0 means not active, Active = 1 means it is active and Active = 2 means it is pending. The problem which this approach is how do you remeber which active value means what.

I am sure that you have faced the same problem when designing databases. What approach did you took to solve the problem?

powered by IMHO 1.3

Print | posted @ Tuesday, June 13, 2006 2:01 PM

Twitter