I have a three level database with the following structure (simplified to only show the primary keys):
Table A: a_id
Table B: a_id, b_id
Table C: a_id, b_id, c_i
If you already have a foreign key between table B and table A to make sure table B only contains entries that have a value for a_id
that exists in table A, then the extra FK between table C and table A on a_id
is unnecessary. This requires, of course, that the FK relation between Table B and Table A is encorced, active, and not disabled or circumvented in any way.
Making the FK link between table C and table B already guarantees that TableC.a_id
can only refer to a valid value of a_id
(since that's guaranteed in table B through the FK relation between Table B and Table A).