Kind of like a static variable in an analogy to classes.
For example, lets say i have a table for keeping people. Then for each row I have a bunch of columns: age, sex, name…
But I would like a value to be associated to the table itself, lets say, minimum allowed age = 18. Then, whenever I would add a new person I would check if their age is bigger than Table.minimum_allowed_age. This way I could easely change that value, without beign hard coded anywhere.
The only way I can do it now is by creating a (very ugly) ENUM column that has only one option, 18, and then every row has it. This is obviously not the way to do it, especially if you want to change that value often (which is my case in my application).
Static variables are technically globals. How about using another table to store global properties?
A string for the primary key, another string that is
CASTto an integer in a nested query fetching the value would work.You might as well use an integer value if sufficient or several, differently-typed maybe-
NULLcolumns if you want type safety (you mayCOALESCEandCASTthe result to a string for a fully generic string->string view).For globals that are associated with tables you could establish an appropriate convention, e.g. prefixing the key with the table name and some separator.