I'm using MySQL & I need to create following tables.
1st table : having 3 attributes A,B,C
2nd table : having 2 attributes B,D
3rd table : having 2 attributes C,E
Now, A is the primary key.
I need to create the 2nd-3rd tables, such that the values in B for 2nd table should be already present in 1st table's B attribute, & similarly values in C of 3rd table should be already present in C of 1st table.
My attempts :
1) put A in both, 2nd & 3rd tables, & keep them as foreign key referencing A of 1st table, & put on update cascade in each.
2) keep check constraints for both 2nd & 3rd tables, although I couldnt find proper syntax for the check constraints when attributes are from different tables.
Pl suggest better options or improvise the current approaches I've thought of.