MySQL Forums
Forum List  »  Italian

Re: ON DELETE CASCADE
Posted by: Gavin Towey
Date: July 22, 2010 05:09PM

Il tuo foreign key e' definito da questo riga:
FOREIGN KEY (democat_idcat), REFERENCES parent(idcat) ON DELETE CASCADE,

(infatti, c'era una altra ',' che non e' necessario)

Dice che in questa tabella hai il campo democat_idcat, che sempre deve contiene una value che esiste in la campo idcat nella tabella parent.

Pero' che molti problemi:

1. il campo democat_idcat, non esiste in questa tabella! Tu devi crearlo
2. questo tabella ha ENGINE=MyISAM. MyIsam non funziona con foreign keys, dev'essere InnoDB

il frase 'ON DELETE CASCADE' significa che se tu fare un delete su tabella "parent" ogne record in questa tabella con il value nel campo democat_idcat che paragona il value di idcat da parent table ci sara' deleted.

Options: ReplyQuote


Subject
Views
Written By
Posted
5638
June 19, 2010 06:50AM
Re: ON DELETE CASCADE
3217
July 22, 2010 05:09PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.