title: SQL - how to display products' options, whether or not they have them?
body: <p>Assume a <code>products</code> can have 0 or more <code>options</code> -- implemented with the following tables:</p>
  
  <pre><code>products
   - id
   - name
  
  options
   - id
   - name
  
  product_options
   - id
   - product_id
   - option_id
  </code></pre>
  
  <p>Further assume the following products have the following options:</p>
  
  <ul>
  <li>Product 1 = Option 1, Option 2, Option 3</li>
  <li>Product 2 = Option 2, Option 3, Option 4</li>
  <li>Product 3 = Option 3, Option 4, Option 5</li>
  </ul>
  
  <p><strong>How can I query this so that I get results like this:</strong></p>
  
  <ul>
  <li>Product 1, Option 1, Option 2, Option 3, NULL, NULL</li>
  <li>Product 2, NULL, Option 2, Option 3, Option 4, NULL</li>
  <li>Product 3, NULL, NULL, Option 3, Option 4, Option 5</li>
  </ul>
  
  <p>My options are actually a nested tree. And they have a foreign key to a categories table (also a nested tree). Ultimately, I need to be able to do this query and group the results by category. However, I probably should understand first how to solve this simpler version of my problem.</p>
  
  <p><strong>UPDATE 1:</strong> I do not know in advance what the options might be. Also, there is no limit to the number of options a product may have.</p>