SQL: Foreign key that is a child of another foreign key
问题 I'd like to ask regarding a particular issue I have. For example, I have a Student table that has a SchoolID and a ClassID , both of which are foreign keys to the School and Classroom tables respectively. The Class table has a SchoolID column which is a foreign key to the School table. Is there any way I can ensure that the ClassID in the Student table is a child of the SchoolID , or must I remove the SchoolID and just live with the ClassID in order to prevent any possible discrepancies? 回答1: