How to constrain a table linking two tables in many-to-many relationship

Posted by Gromul on Stack Overflow See other posts from Stack Overflow or by Gromul
Published on 2010-06-02T01:49:08Z Indexed on 2010/06/02 1:53 UTC
Read the original article Hit count: 211

Say I have the following tables and columns:

comp: id, model dvd: id, model comp2dvd: id, id_comp, id_dvd

A computer can have multiple dvd drives, even of the same model, and a dvd drive can appear in multiple computers. How do I make it so that comp2dvd table can have only existing comp and dvd ids?

Thanks

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server