Related issues with Table associations

Source: Internet
Author: User
Table-related issues
There are three tables, which are album table, product table, Picture table, respectively.
Requirements: Albums can be stored in both products and pictures.
How would you like to express the relationship between the three people?

I analyzed that albums and products are many-to-many relationships, and albums and pictures are many-to-many relationships.
Do you want to design two intermediate tables?

Share to:


------Solution--------------------
then separate it.
Feature ID Product ID
Feature ID Image ID

Since it's two entities, why do you have to pull it 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 for sure!
But you just need to INNER JOIN.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.