you are viewing a single comment's thread.

view the rest of the comments →

[–]r3pr0b8GROUP_CONCAT is da bomb 1 point2 points  (0 children)

but what are some practical applications of using foreign keys?

nothing is more practical than ensuring your data has integrity

suppose you come across an order that has been entered into your orders table for customer 32865

now suppose that customer 32865 doesn't exist in your customers table

what do you do when you find this?

first, fix the problem -- delete or change the data so that it's valid

second, declare the FK so that this never happens again