What is the disadvantage for many to many table relationship

Posted on 2009-04-21
Last Modified: 2013-11-16
If we do query from 2 tables which have many to many relationship, what will be the potential cause issue. and why ?
Question by:isnotaboutu

    Accepted Solution

    A normalized Many-to-Many (M2M) relationship typically uses 3 tables - two fact tables and a join table.  For example, if many copies of a given book may be sold at many book stores, you might design your M2M relationsip with these tables:

    id (int)
    title (varchar)
    pubdate (datetime)

    -- STORE --
    id (int)
    name (varchar)
    address (varchar)
    phone (varchar)

    -- STORE_BOOK --
    Book_id (int)
    Store_id (int)

    The only "downside" to doing this is that you might want to join the tables together when searching for stores that cary your book, and joins incur some overhead.  The upside is that since your book information and store information live in their own tables, you don't have to reapeat that stuff across many tables (which has an impact on the physical size of your database and therefore affects disc storage space).
     In a DataWarehousing system, you might "de-normalize" those 3 tables into one to make your queries perform faster since they wouldn't bother with any joins.

    Author Comment

    If we don't have a bridgae table to handle many to many table relationship, can we still get the correct information on query ?
    LVL 6

    Assisted Solution

    Bear in mind that nearly every fact table in a data warehouse is that third table serving as the many-many relationship between dimensions tables.
    In light of the example above, you likely won't find a table called "store has book", but you might have, say, a PurchaseOrder table that records that a book was ordered to be stocked in or shipped out of that store.  Then you might have another table called SalesOrder that records the book was sold out of that store.
    In order to get an answer to your question, you may need to provide a few more details.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now