I often use (what I call) 'flag' columns in my DBs, such as the following:
Column 'Type':
0 = CREATOR
1 = OPERATIVE
2 = APPROVER
But is this the right way to do this? I only ask because it might be confusing coming back to it later when I don't remember what zero, one, two, or three mean. Wouldn't it be better to simple mark them as CREATOR etc?
What is the general accepted practice for this?
A flag is typically a boolean true and false or 0 and 1 expressed in a bit (MySQL 5.0.3+), or tinyint. If you have more than 2 possible values, those values could be stored in an ENUM within MySQL, otherwise, those possible values should be stored in their own table and referenced using a foreign key relationship (normalization).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With