title: Primary and foreign key relations in several tables
body: <p>I have a question regarding SQL. I have the following SQL tables (Simplified for easy comprehension):</p>
  
  <p>Client(clientId INT PRIMARY KEY)</p>
  
  <p>Product (productId PRIMARY KEY)</p>
  
  <p>Order (orderId PRIMARY, clientId which is foreign key to Client, productId which is foreign key to Product)</p>
  
  <p>I also have a table called Inventory, which is supposed to contain the number of items in stock for each product. The primary key to Inventory is called productId (Primary Key), which references the foreign key in Order. 
  Unfortunately, when I try to add to the Inventory table, it gives me the following error:</p>
  
  <pre><code>"The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Order_Iventory1". The conflict occurred in database "GestionInventaire", table "dbo.Inventory", column 'productId'."
  </code></pre>
  
  <p>I want the Inventory tables primary ID (productId) to be the foreign key in Order (productId), which comes from the Product table.</p>
  
  <p>Any help is appreciated! If any further explanation is required I will try to elaborate further.</p>