I have 2 tables (Table_A and Table_B) that have a many-to-many relationship. I create a relationship table called Table_AB
BUT my second question still stands.
Code:
[U][B]Table_[/B]A[/U]
-A_id (PK)
.
.
.
.
[U][B]Table_A[/B]B[/U]
-A_id (PK,FK)
-B_id (PK,FK)
[U][B]Table_B[/B][/U]
-B_id (PK)
.
.
.
.
- When I insert into both Table_A and Table_B, do I also have to insert into the relationship table or does it automatically resolve itself?
Code:insert into Table_A(A_id) values ('A0001')Code:insert into Table_B(B_id) values ('B00001') - What will be my sql when I want to select from these two tables? Will it be:
Code:select a.A_id, b.B_id from Table_A a, Table_b b, Table_AB ab WHERE a.A_id = ab.A_id AND b.B_id =ab.B_id
BUT my second question still stands.
Last edited: