> I think he's trying to exploit ON UPDATE CASCADE so he can execute
> a single UPDATE on the referenced table instead of having to write
> multiple UPDATE statements, one for each referencing table. The
> problem is that he's trying to change the referenced value from 2
> to 1 but 1 already exist
On Mon, Mar 28, 2005 at 09:41:03AM -0600, Thomas F.O'Connell wrote:
> I've only been explaining general database theory and the rules of SQL
> in response to your posts because I'm still having a difficult time
> understanding what you're trying to accomplish.
I think he's trying to exploit ON
If you declare parent.code to be a primary key, you're asserting that
you want it to be unique across all rows in parent. Thus, you will only
ever (be able to) have a single row with a value of 1.
If you do this:
INSERT INTO parent VALUES ('1');
INSERT INTO parent VALUES ('2');
UPDATE parent SET