Re: [SQL] enforcing constraints across multiple tables

2010-06-25 Thread Ben Morrow
Quoth andrew.ge...@gmail.com (Andrew Geery): > > I have a question about checking a constraint that is spread across multiple > (in the example below, two) tables. In the example below, every food (food > table) is in a food group (food_group table). For every person (person > table), I want to

Re: [SQL] enforcing constraints across multiple tables

2010-06-25 Thread Tim Landscheidt
Andrew Geery wrote: > [...] > My questions are: > (A) Is there a way to check (2) above using a constraint and not a trigger? > (B) Is there an easier way to solve this problem? Does the complicated > nature of the solution make the design poor? > (C) Should I not worry about this constraint at

[SQL] enforcing constraints across multiple tables

2010-06-25 Thread Andrew Geery
I have a question about checking a constraint that is spread across multiple (in the example below, two) tables. In the example below, every food (food table) is in a food group (food_group table). For every person (person table), I want to enforce the constraint that there can only be one food i