I am creating a small database of names that has three columns: ID, Name, Status
The ‘status’ can be one of three things: waiting, approved, other
My question is, what is the best/most correct way to store the ‘status’ in the DB? Should it be stored as a varchar string or as a 1, 2, or 3 integer and later translate that to waiting/approved/other when reading from the DB? I hope that makes sense, thanks for any help.
You should have a status table (referred to as a dictionary or lookup table) using a
tinyintdata type to reference that status. You would use a foreign key constraint. This way you maintain relational and domain integrity. It will allow you to add/change/remove status values without changing table structure.