Relationships (1:1)

Archived from the Xataface Users forum.

wisni1rr — Tue Feb 14, 2012 3:19 pm

Hi again,

I am wondering how you can incorporate a 1to 1 relationship with xataface? I have several 1to 1 relationships in my current access project that I am converting to mySQL. I’m not sure how I should approach the situation…

Thanks for any advice you can provide!


samhans — Tue Feb 14, 2012 6:12 pm

very easy. just look at the tutorial in the documentation part.
if you find any problem then come back.


wisni1rr — Tue Feb 14, 2012 6:53 pm

Thanks for helping,

I went through the tutorial. It gives great examples for “1 to many” and “many to many” but I don’t gather how to do a “1 to 1” relationship. Consider the following:

[TableA]
ID = INT(11) Auto_Increment, Primary

[TableB]
ID = INT(11)

For every record in [TableA] there can be exactly ONE OR NONE record in [TableB]

Could this be achieved by making ID in [TableB] unique?


samhans — Tue Feb 14, 2012 11:10 pm

could you explain more.

do you want any connection between table A and table B to be displayed in table A. or you just want that the id field of the table B to be filled from table A automatically.


shannah — Wed Feb 15, 2012 9:46 am

1:1 relationships currently are a bit tricky to deal with. I’ve had this on my list for a while but haven’t gotten around to it. You can muddle around with regular relationships and kind of fudge it in there, but we really need to have a special case for 1:1.


wisni1rr — Wed Feb 15, 2012 12:08 pm

Thanks for you help!

I’ve decided to make a 1:many relation and set my many table to have its connecting record Index as Unique.

Thanks again!