What is the difference between check and foreign key?

Posted by GigaPr on Stack Overflow See other posts from Stack Overflow or by GigaPr
Published on 2010-04-11T17:25:56Z Indexed on 2010/04/11 17:33 UTC
Read the original article Hit count: 164

Filed under:

Hi,

i am quite confused about the difference between a FOREIGN KEY and CHECK constraint.

they appear to me to achieve the same result.

I mean I could create a table and enforce a Foreign key on another table, but i could create

a CHECK to ensure the value in in another table.

What is the difference and when to use the one or the other?

thanks

© Stack Overflow or respective owner

Related posts about sql