Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2001062

Re: [PHP-DB] Design conundrum... From: Antonio Mármol Albert (toni <email protected>)
Date: 06/23/01

El sábado 23 de junio de 2001 (13:52), Kristian Duske escribió:

> > The problem involves 2 tables, one of editors and one of categories, both
> > have unique ID numbers. Each editor can have authority over an arbitrary
> > number of categories, and conversely, each category can have an arbitrary
> > number of editors. So what is the best way to represent this in the DB?
> > (Which is PostgreSQL 7 BTW)
>
> This is a so-called N:N relation, and this usually calls for a third table
> to store the cross-relations:
>
> table editors
> id, name, email
>
> table categories
> id, name
>
> table ediors_categories
> editor (id of editor)
> category (id of category)

With index in the third table, How would it be ?

PRIMARY KEY (editor, category)

 or

KEY (editor),
KEY (category)

What's the better (more efficient and correct) ??

Regards

-- 
Antonio Mármol Albert ( toni <email protected> )
http://www.infurma.es

-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>