novice: table design FOREIGN key

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All

    Thanks for all your comments on my previous mail, very much appreciated.
I'm stuck again!
    I've created the following lookup table for m <-> m relationship between
a Group and a Contact table.

CREATE TABLE Group_Contact(
  GroupID INT NOT NULL,
  ContactID INT NOT NULL,

  Index (GroupID),
  FOREIGN KEY (GroupID) REFERENCES Group (PKey) ON DELETE CASCADE,
  Index (ContactID),
  FOREIGN KEY (ContactID) REFERENCES Contact (PKey) ON DELETE CASCADE
) TYPE=InnoDB COMMENT='Group to Contact lookup';

what do I need to do to ensure only unique (GroupID,ContactID) pair can be
inserted into the table?

Thanks
Tony Yau

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux