Colin > Scouring the schema the other day I came across the two settings below concerning >foreign-keys. I'm currently not using them. Can anyone (briefly) explain their use, >and is anyone actually using them?
If these correspond to their RDBMS equivalents, and I'm guessing they do although I don't currently use them, then they both deal with preserving referential integrity. > on delete set null will set foreign keys to null when you delete a related row. For a simple example, you have a Customer table and an Order table. Customer | Order -------- | --------- customerId | orderId customerName | customerId A one-to-many relationship exists between Customer and Order via the customerId key, so that a Customer can have many Order entries. If you delete a Customer and "on delete set null" is active, then the Order table will receive a UPDATE Order SET customerId = null WHERE customerId = [the one you deleted] This will disolve the relationship and preserve referentail integrity. > on update cascade will update all related foreign keys. So, if you change customerId on a Customer row, the Order table will receive a UPDATE Order SET customerId = [new customerId] WHERE customerId = [old customerId] Does that help? Eric -- Eric Emminger [EMAIL PROTECTED] -- To unsubscribe, e-mail: <mailto:turbine-torque-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:turbine-torque-user-help@;jakarta.apache.org>
