Should all foreign table references use foreign key constraints

Posted by TecBrat on Programmers See other posts from Programmers or by TecBrat
Published on 2014-05-06T19:08:14Z Indexed on 2014/06/07 3:45 UTC
Read the original article Hit count: 346

Closely related to: Foreign key restrictions -> yes or no?

I asked a question on SO and it led me to ask this here.

If I'm faced with a choice of having a circular reference or just not enforcing the restraint, which is the better choice?

In my particular case I have customers and addresses. I want an address to have a reference to a customer and I want each customer to have a default billing address id and a default shipping address id.

I might query for all addresses that have a certain customer ID or I might query for the address with the ID that matches the default shipping or billing address ids.

I'm not sure yet how the constraints (or lack of) will effect the system as my application and it's data age.

© Programmers or respective owner

Related posts about database-design

Related posts about mysql