I have a question, in a T-SQL setting which is faster and better and futureproof?
Is it easier to have a lookup table with IDs and status entries as so
ID | Status
-------------
01 | Success
02 | Failure
03 | Processing
Or is it better to just enter the status values in per row?
How does this effect writing queries, is it good relational database design to use a lookup table rather than just entering a status into rows? Is one faster than the other?
I feel that lookup tables are the way to go, but I’m not seeing that so much in some databases.
I personally would use a separate status table for those items. Then you will use a foreign key between your main table and the separate status table. As far as querying you will just use a
JOINto include the actual status name.I think it allows for more flexibility, in the event your status names change you are only changing the values in your separate table rather than performing an
UPDATEagainst your main table.Your table structure could be similar to this: