SQL Constraint that one column value cannot be greater than another in a different table
问题 This probably isn't a very nice question as its blending business logic with DB structure, but its not my decision so: Is it possible to define a constraint the infers the value of one column (Table A, Column X) cannot be greater than the value of another (Table B, Column Y) referenced via a foreign key: TABLE_A ID (Primary Key) X (int value) TABLE_B A_ID (Foreign Key to TABLE_A) Y (int value) i.e. I want to enforce that for all values of Y, Y < L where L is a value from X where TABLE_B.A_ID