RE: How to Use Cascade Delete Properly

2009-01-02 Thread Martin Gainty
recipient. Sender does not necessarily endorse content contained within this transmission. > From: jschwa...@the-infoshop.com > To: l...@his.com; mysql@lists.mysql.com > Subject: RE: How to Use Cascade Delete Properly > Date: Fri, 2 Jan 2009 10:24:14 -0500 > > > > &

RE: How to Use Cascade Delete Properly

2009-01-02 Thread Jerry Schwartz
>-Original Message- >From: Lola J. Lee Beno [mailto:l...@his.com] >Sent: Thursday, January 01, 2009 5:08 PM >To: 'MySQL' >Subject: How to Use Cascade Delete Properly > >I'm trying to understand how to use cascade delete properly but not sure >if I

Re: How to Use Cascade Delete Properly

2009-01-02 Thread Ian Simpson
That looks ok to me; I seem to have misremembered the RESTRICT keyword as CONSTRAIN, since it's been a while since I've had to use it. Bear in mind that I don't think MySQL has a check to make sure that the same foreign key does not already exist; I have seen a table that had the same foreign key

Re: How to Use Cascade Delete Properly

2009-01-02 Thread Lola J. Lee Beno
Ian Simpson wrote: If you want deletes to be blocked, then you shouldn't be using ON DELETE CASCADE; the default behaviour is ON DELETE CONSTRAIN, which seems to be what you want; it will refuse to delete any rows that are depended on by rows in other tables. Wouldn't that be: ALTER TABLE `

Re: How to Use Cascade Delete Properly

2009-01-02 Thread Ian Simpson
Beno wrote: > I'm trying to understand how to use cascade delete properly but not sure > if I have this backwards or not. Here's an example: > > I have two tables: > > mysql> describe adsource; > +-+--+--+-+-+---+ >

How to Use Cascade Delete Properly

2009-01-01 Thread Lola J. Lee Beno
I'm trying to understand how to use cascade delete properly but not sure if I have this backwards or not. Here's an example: I have two tables: mysql> describe adsource; +-+--+--+-+-+---+ | Field | Type | Null | Key | De