On 30 April 2010 12:26, Karl DeSaulniers <k...@designdrumm.com> wrote:
> Thanks Peter.
> So what is the logic behind foreign keys? Why use them?
Constraints. When using, for example, the InnoDB engine in MySQL, you
can set foreign key fields on tables. These ensure that your record
will always be bound to a proper record in the connected table - so,
for instance, you won't find yourself in the situation that you have
deleted a record from table1 but table2 still references the table1
record. Also, they're very useful for tying models together
automatically, as you can deduce relationships between models by
foreign keys, for instance (this is simplified but covers a lot of
WWW: http://plphp.dk / http://plind.dk
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php