> Kristina Anderson wrote:
> > Exactly, the table would contain probably nothing more than a 
primary 
> > key autonumber field, the user id and account id in each row.
> 
> Why do you need a separate primary key?  The relationship is defined 
by
> user id and account id.
> 
> CREATE TABLE some_rel (
>   user_id int(11) not null,
>   account_id int(11) not null,
>   some_attribute varchar(255),
>   PRIMARY KEY (user_id,account_id)
> );
> 
> I added the attribute column to illustrate that you can still identify
> the row like:
> 
> SELECT some_attribute FROM some_rel WHERE user_id=X AND account_id=Y
> 
> HTH,
> 
> Dan
> 
Dan,

As soon as I wrote this post I knew someone was going to bring that up 
and you're entirely right!


Kristina
_______________________________________________
New York PHP Users Group Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

http://www.nyphp.org/Show-Participation

Reply via email to