NYCPHP Meetup

NYPHP.org

[nycphp-talk] A tale of two tables...

Aaron Fischer agfische at email.smith.edu
Fri Mar 11 15:46:19 EST 2005



> The first question is what kind of relationship are you trying to 
> model here?
>
> Is it:
> - one-one   - each host is matched to a single guest
>

Yes, it's one-one.

> If it is 1-1, then you would only need a column in the host table to 
> hold the id of the matched guest, with a unique index to prevent 
> multiple hosts being matched to the same guest.  You could also do 
> this in reverse (add a column to the guest table to hold the id of the 
> matched host)
>
> Dan

<slaps forehead>

I do indeed have a unique index (in both tables).  I'm a bit of a SQL 
(joining) novice.  I will create the column in one of the tables to 
hold the unique id of the other.

That's really cool, simple and elegant, I love it.

Thanks Dan!

-Aaron




More information about the talk mailing list