-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01-Jul-2002/18:53 -0500, Chad Skinner <[EMAIL PROTECTED]> wrote:
>I am trying to create a database that has a many-to-many relationship. We
>can build the tables without any problems, but I am trying to find out if
>it
>is possible to cascade delete the items in the related fields.
>
>Tables:
>a - column_1 (Primary Key)
>b - column_2 (Primary Key)
>
>c - fk_a_column_1 (Foreign key to a column_1)
>    fk_b_column_2 (Foreign key to a column_2)
>
>Is it possible to setup a relationship so that when a record in table a
>is
>deleted its related records in b are deleted as well.

I've never done this, but according to the docs I found, this should work:

create table c(
 fk_a_column_1 foreign key references a(column_1) on delete cascade
 fk_b_column_2 foreign key references b(column_2) on delete cascade
);

If not, ask on a postgre


Tony
- -- 
Anthony E. Greene <mailto:[EMAIL PROTECTED]>
OpenPGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26  C484 A42A 60DD 6C94 239D
AOL/Yahoo Messenger: TonyG05    HomePage: <http://www.pobox.com/~agreene/>
Linux. The choice of a GNU generation <http://www.linux.org/>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Anthony E. Greene <mailto:[EMAIL PROTECTED]> 0x6C94239D

iD8DBQE9ImIcpCpg3WyUI50RAnKxAJ4yHQvRdbTxU8DoUSGKbVYaIE0/pgCeJ0Hn
pdg4Tuttf2M8tzkKEqYv9LY=
=UCWq
-----END PGP SIGNATURE-----



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to