Friday, August 5, 2011

SQL: How do you foreign key a foreign key?

Simply give table2's field name as the reference to table3's foreign key field - this basically creates a chain of nested domains where table2's field is limited to the current existing values in table1's field (or NULL) and table3's field to the currently-existing subset of table1 values in table2 (or again, possibly NULL.)

No comments:

Post a Comment