Do we always have to update or insert? Why can't we just relate?
- From: arthernan@xxxxxxxxxxx
- Date: 10 Oct 2005 16:43:18 -0700
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. This
sounds 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
.
- Follow-Ups:
- Re: Do we always have to update or insert? Why can't we just relate?
- From: Troels Arvin
- Re: Do we always have to update or insert? Why can't we just relate?
- Prev by Date: Re: Looking for how to model 3D objects in 2D relational databases
- Next by Date: Re: Looking for how to model 3D objects in 2D relational databases
- Previous by thread: Federalist strategy or choice in ER diagrams design
- Next by thread: Re: Do we always have to update or insert? Why can't we just relate?
- Index(es):
Relevant Pages
|
|