Re: Junction entities VS. JOIN

2001-01-24 Thread Dylan Shea
Benjamin, beautifully put. Thank you both so much. --Dylan Shea Benjamin Pflugmann wrote: > Hi. > > It's simply that you can look at (a_id,b_id) as a PRIMARY KEY. You > don't need an additional, aritificial sequence number ab_id. > > CREATE TABLE table_ab ( > a_id INT NOT NULL, > b_id INT

Re: Junction entities VS. JOIN

2001-01-24 Thread Benjamin Pflugmann
Hi. It's simply that you can look at (a_id,b_id) as a PRIMARY KEY. You don't need an additional, aritificial sequence number ab_id. CREATE TABLE table_ab ( a_id INT NOT NULL, b_id INT NOT NULL, PRIMARY KEY (a_id,b_id), UNIQUE (b_id,a_id) ) Replace INT by whatever type seems appropriate

Re: Junction entities VS. JOIN

2001-01-24 Thread Dylan Shea
Thanks. (I don't know where I was coming from with the JOIN stuff, should have gone to bed hours ago) However, you don't think I should have the "ab_id" column, which would be the standard serial primary key for a table. Does a junction entity table not need it's own record ids? Technically, i

RE: Junction entities VS. JOIN

2001-01-24 Thread Carsten H. Pedersen
> 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. > > and they have a many to many relationship between them. Should I > a.

Junction entities VS. JOIN

2001-01-24 Thread Dylan Shea
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. table_atable_b a_idb_id a_field1 b_field1 .