Hi,
I've just started playing with SQL and postgres, and I have a question
about multiple foreign keys.
Let's say we have three tables "student", "teacher" and "staff", plus a
table "comment" with attributes like "date" and "text". We want zero or
N comments to be associated with each row of the other three tables.
I was thinking of creating three foreign keys in the "comment" table,
say "fk_student", "fk_teacher" and "fk_staff". Now, is there a way to
impose a constraint that a comment row must have one and only one NOT
NULL fk value?
If this is not the correct way to solve the problem, what alternative
solutions are there?
Best,
P.