(Beware, that might be one of the first academical questions on SQLA.) In a longer comment dialogue between Breck and me on the following question, I raised the following question - now asking it here: Is there a DRI action that is directed from the child to the parent table? I.e. the action would be initiated if a row in a child table would be modified or deleted, and the referenced row in the parent table would be altered - exactly the other way around as in a typical DRI action (like ON DELETE CASCADE). I know the answer is "No!" for SQL Anywhere (and I guess, for other DBMSs, too), but I would like to ask if something like that has ever been put into thought. Breck has invented the following syntax (making its future quite improbable):
Why would I want such a feature (not with that name, for sure!)? Well, at times when doing data-modelling, I feel the need to introduce a reference between a so-called child table and a parent table where the parent table would be a weak entity in ER terms whereas the child table would be a strong entity. One might call the weak entity a "common attribute" of the strong entity.
In that scenario, it would be handy if one could express that the "parent-side" of a relationship would be influenced when no more child does reference that parent. Today, I would use trigger code to delete the address if there's no more usage, and this feature might be uncommon enough to leave it that way. On the other hand, DRI actions have been introduced to prevent the usage of the more error-prone triggers for common tasks. Other usages might be "code tables" where one might want to delete an entry when it isn't used anymore, or the tags used in SQLA: It seems that they get deleted (over night in some clean-up, methinks) when there is no more question tagged with them. Any hints are highly appreciated:) |
Funny sidenote: This is the first time if was asked "Are you a human being?" when raising a question on SQLA. Too academic?
Well, are you? ;-))
@Reimer: What do you mean - human or too academic? Well, I solved the CAPTCHA so consider me human - at least according to current Turing test definitions:)