In SQL terms, referential integrity constraints usually means foreign keys.
Perhaps you meant data integrity constraints? If so, we should probably extend your definition to include CREATE ASSERTION
and perhaps CREATE DOMAIN
. This would allow constraints of arbitrary complexity to be enforced. However, "Any given business logic" is an unreasonable requirement in practice and enforcing every business rule at the DBMS level may be undesirable.
Thank you for your input. I was however specifically concerned with foreign keys and check constraints.
May I ask why? On the face it, it seems arbitrary an arbitrary classification.
It will depend on whether the CHECK
constraints you have in mind support subqueries. If yes then this will still allow constraints of arbitrary complexity but will only be triggered on the table being updated i.e. if a CHECK
constraints definition involves two tables then a complementary CHECK
constraint may be required on the second table.
That said, I don’t know of an industrial-strength SQL product that supports subqueries (the Access Database Engine does but I don't consider it to be industrial-strength). However, many SQL products provide as a workaround that support subqueries (and procedural code plus much more). Perhaps your definition should allow tiggers.