3 ms·
Convenience. Having a table mapping id to string is logically equivalent and plays nicer with transactions. But it's much less convenient. In principle SQL dat
by patrec 8y ago
Convenience. Having a table mapping id to string is logically equivalent and plays nicer with transactions. But it's much less convenient.
In principle SQL databases could have some sugar for foreign keys to tables that just bijectively map ids to human-readable identifiers, but they don't. I always wondered why not.
With enums I get readable, type-checked values I can auto-complete on and that I can use "in-place". With a table I don't get auto-completion and I need to do a join for readability if my enums are "true" enums (and have an ordering).