The "many" side of a one:many relationship can be a field that allows nulls. That is quite unusual, but it is legal in SQL. Now consider this scenario:
I have tableA, tableB, and tableC.
TableB has a one:many relationship with tableA. That relationship is NOT mandatory.
TableC has a one:many relationship with tableA. That relationship is NOT mandatory.
There is no way to fuse tableB and tableC. They have different fields.
Now, here is the kicker:
Each record in tableA MUST have a corresponding record in tableB OR a corresponding record in tableC. Moreover, the record in tableA may NOT have a corresponding record in both B and C.
I understand that I could implement this using triggers. But that is less than elegant. Is there a way that I can implement the either/or logic through the schema itself?
I have tableA, tableB, and tableC.
TableB has a one:many relationship with tableA. That relationship is NOT mandatory.
TableC has a one:many relationship with tableA. That relationship is NOT mandatory.
There is no way to fuse tableB and tableC. They have different fields.
Now, here is the kicker:
Each record in tableA MUST have a corresponding record in tableB OR a corresponding record in tableC. Moreover, the record in tableA may NOT have a corresponding record in both B and C.
I understand that I could implement this using triggers. But that is less than elegant. Is there a way that I can implement the either/or logic through the schema itself?