> CREATE TABLE foo_bar_map ( > id INTEGER AUTO_INCREMENT PRIMARY KEY NOT NULL, > foo_id INTEGER, > bar_id INTEGER, > FOREIGN KEY(foo_id) REFERENCES foos(id), > INDEX(foo_id), > FOREIGN KEY(bar_id) REFERENCES bars(id), > INDEX(bar_id) > )Type=InnoDB;
You could add a UNIQUE INDEX(foo_id, bar_id) > mysql> select * from foo_bar_map; > +----+--------+--------+ > | id | foo_id | bar_id | > +----+--------+--------+ > | 1 | 1 | 1 | > | 2 | 1 | 1 | > +----+--------+--------+ ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Rose-db-object mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rose-db-object
