Table Association problems include the following three tables: Album table, product table, and image table. Requirement: the album can be saved to products and images at the same time. How can we express the relationship between the three elements? I analyzed the relationship between albums and products, and between albums and images. Do you want to design two intermediate tables? Table Association problems
The following three tables are available: Album table, product table, and image table.
Requirement: the album can be saved to products and images at the same time.
How can we express the relationship between the three elements?
I analyzed the relationship between albums and products, and between albums and images.
Do you want to design two intermediate tables?
Share:
------ Solution --------------------
Then separate them.
Topic id product id
Topic id Image id
Since there are two entities, why do you need to get them together?
Do you want to design two intermediate tables?
------ Solution --------------------
Select * from A left join A_ B on A. id = A_ B .aid left join A_C on A. id = A_C.aid
------ Solution --------------------
That's of course!
But you only need inner join.