title: Database Design: Circular dependency
body: <p>Imagine the following database: </p>
  
  <p>Table 'companies' has fields id, name and flagship_product_id.
  Table 'products' have fields id, name and company_id.</p>
  
  <p>A company must have a flagship product (1:1 relationship) and all products have one company (1:N relationship).</p>
  
  <p>When using a storage engine such as MyISM, there shouldn't be any problem with the above scenario, but when using an engine such as InnoDB, problems result when INSERTing new data.</p>
  
  <p>What is a good solution except allowing a NULL relationship for the initial INSERT?</p>
  
  <p>To summarize, A company <strong>must</strong> have <strong>one</strong> flagship product.</p>