title: MySQL Query - Create a Trigger that updates stock levels once a sale takes place
body: <p>I need to create a trigger to update my stock levels every time a product is purchased. I'm very new to MySQL so any help would be greatly appreciated and, please, if you can formulate an answer as if you're explaining it to a 5-year old child, that would be great :) </p>
  
  <p>I have two tables which seem appropriate for this, with Product_ID common to both;</p>
  
  <ul>
  <li><p><strong>Products</strong> (Product_ID, Category_ID, Supplier_ID, Product_Name, Description, Size,  Colour, Cost_Price_Eur, Selling_Price_Eur, Total_Stock)</p></li>
  <li><p><strong>Order_Details</strong> (Order_Details_ID, Order_ID, Product_ID, Quantity_Sold)</p></li>
  </ul>
  
  <p>Any attempt to date has failed. In fact, I just get the following;</p>
  
  <blockquote>
    <p>Error Code: 1064. You have an error in your SQL syntax; check the
    manual that corresponds to your MySQL server version for the right
    syntax to use near 'on order_details' at line 1</p>
  </blockquote>
  
  <p>after the most basic of code below;</p>
  
  <pre><code>USE Shoes_By_Sean_Online
  
  CREATE TRIGGER Stock_Update on order_details
  </code></pre>
  
  <p>Again, any help is greatly appreciated. Thanks.</p>