Re: Design conundrum...
| From: | Antonio Mármol Albert | Date: | Sat, 23 Jun 2001 13:10:18 +0000 |
| Subject: | Re: Design conundrum... | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-9765@lists.php.net to get a copy of this message | ||
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@infurma.es )
http://www.infurma.es