title: Solution for decomposing/avoiding Many to Many relationship
body: <p>As far as I know, there are two options to deal with Many-to-Many relation in a relational database (MySQL, MariaDB) and object-relational database (Postgres)</p>
  <p>Common scenario:</p>
  <p>---&gt; A Product appears(has) many bills</p>
  <p>---&gt; A bill has many products</p>
  <p>===&gt; Product (n) ------&gt; (n) Bill</p>
  <p>I've googled to find a way to decompose Many-to-Many and here is my result:</p>
  <ol>
  <li>Create a lookup table that takes 2 Product_ID and Bill_ID as foreign keys to decompose the Many-to-Many relationship into two One-to-Many. This is fine for both relational and object-relational database</li>
  <li>Take advantage of object-relational database data type such as an array, JSON, etc. For example, add product_ids as an array of an integer into Bill table and vice versa (Like this tutorial: <a href="http://blog.bguiz.com/2017/postgres-many2many-sql-non-relational/" rel="nofollow noreferrer">http://blog.bguiz.com/2017/postgres-many2many-sql-non-relational/</a>)</li>
  </ol>
  <p>So I tried to seek another solution and I found this: <a href="https://dba.stackexchange.com/questions/175894/mutually-exclusive-many-to-many-relationships/175908#175908">https://dba.stackexchange.com/questions/175894/mutually-exclusive-many-to-many-relationships/175908#175908</a></p>
  <p>But it seems unclear to me</p>
  <p>So I was wondering any others solution for the object-relational database (Postgres)? any keywords?
  I really appropriate your help
  Thank you</p>