SQL; Unique constraint across tables
Recently I encountered several different data objects that all have a property akin to an 'id assigned by the company'. This field is a human readable string with a prescribed format, incremented by one shared sequence. Using a highly unique property like a UUID was sadly ruled out. In the legacy data there seemed to be clear problems with keeping data consistent even within tables, so the database design is being implemented defensively. It's possible to implement such a field as a One to One relationship from an ' id_from_company ' table to the other tables. But this does not prevent the same id_from_company to be used twice, by using it in two different tables. To uphold uniqueness across multiple tables, each table sadly needed to have a check constraint added, that checks for this uniqueness. I wouldn't soon recommend such a "unique over multiple columns" property, because of the overhead I imagine it creates. But it already existed, and ...