> I'm afraid this borders on sql/db question material vs. specific mysql
> material, but it stems from what I've read in the O'Reilly mysql book.
>
> If I have a db, which has two tables that have about 15 fields each.
>
<cut>
> and they have a many to many relationship between them. Should I
> a. Create a normalized junction entity.?
Yes.
> table_ab
> ab_id
> a_id
> b_id
Almost right: You don't need an ab_id column. You should,
however, in most cases make the key (a_id, b_id) UNIQUE.
> or do I
> b. Just do a JOIN between the tables?
Not unless you have very little data in your tables or
a lot of patience when doing queries. Besides, It won't
do exactly what you need anyway so you'd end up doing
some post-analysis.
> If choice a., how do I do the indexing so that searches for b_id based
> on a a_id value are fast, and vice-versa?
By indexing both a_id and b_id.
/ Carsten
--
Carsten H. Pedersen
keeper and maintainer of the bitbybit.dk MySQL FAQ
http://www.bitbybit.dk/mysqlfaq
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php