I'd like iterate on the answer @Blaise gave.
This adresses mostly the title of this question and not the actual question itself, but I still want to point out what I know as a "lookup table".
In the company where I work at we develop a web app with lots of "enum" values. Imagine that in almost every HTML form there is at least one dropdown with +10 options to pick from. In other forms there may be dozens of checkboxes you can tick to enable or disable some aspects of our system.
Historically I have hardcoded this type of data into my program because I didn't see it as "live" data and therefore not worthy of saving in a relational db. But then a collegue of mine suggested doing so and I quickly adopted that.
An example of such a lookup table (incl. data):
feature
-------
id int (PK): 1, 2, ...
key varchar: "fulltextSearch", "apiDebugger"
name: "Use fulltext search", "Enable API debugging console"
Tables like these would have dozens of rows representing system settings, feature flags, etc.
This gets interesting and useful when developing a system with multitenancy in mind. In such a system it could be possible to manage settings / features per tenant with a n-m relation table:
tenant
______
id int (PK): 1, 2, ...
name varchar: "Your Company", "My Company"
tenant_feature
______________
tenant_id int (foreign key to tenant.id)
feature_id int (foreign key to feature.id)
feature_config varchar: {...}, {...}
tenant_feature
now serves not only as the table linking tenants to features but also contains added information like configuration metadata for a given feature.
I haven't used this pattern on a lot of applications, but in my current project this allows me a couple of things to do:
- If business requires new features / settings / etc. to be disabled or rolled out step by step for only some systems, I can simply add a
active
column to the lookup table and use that instead of building separate applications, one with a feature enabled, one with it disabled
- If enum values are added, changed and removed frequently, this allows me to quickly build an API arround this table to enable key users to do that for me.