Do we always have to update or insert? Why can't we just relate?
Date: 10 Oct 2005 16:43:18 -0700
Message-ID: <1128987798.833292.217870_at_g43g2000cwa.googlegroups.com>
Many times when dealing with database updates I find myself writing something like this:
Update .... set .. where ... If (no update was done) then Insert ..... end if Or also: If (Record not in database) then Insert ..... Else Update .... set .. where ... End if Should there be a command that does both. Maybe RELATE. Thissounds more assertive instead of the sequential implication of insert or update. Now if such command existed would the other two even be necessary. If we inserted a relation of items that were already related wouldn't that be a duplicate record?
So I tried to come up with situations where two "identical" inserts would make sense. If there was a table that had identical records but for their primary keys. I would argue that foreign keys in other tables somehow make them different. Then some version of RELATE would do the work. In the ideal case that there were no foreign keys pointing to that table. If for some reason we had missing information that prevented us from distinguishing these records. Couldn't we change the schema to count how many of this "identical" records did we find. And therefore RELATE to the number of instances?
This is far from being a formal description. But I have a feeling that this issue has been raised before. Does tutorial-D deal with this?
Arturo Hernandez Received on Tue Oct 11 2005 - 01:43:18 CEST