title: MYSQL storing HTML block vs subdividing and creating tables for children
body: <p>I'm creating blocks of <code>contenteditable</code> DIVs that contain DIVs of text blocks and SPANs around individual words or phrases. The SPANs were being saved to the database as separate entities. I did not see the need to subdivide and create separate tables and columns in order to avoid using html code (I have no idea whether this or that is good practice).</p>
  
  <p>Now that my ideas have ran rampant, I'm wondering whether in fact it will be better to store every wrapper, child div and span as separate entities in the database, along with associated properties. It might take a bit to set up, but I'm wondering about the pros and cons of one approach vs the other. </p>
  
  <p>For example, is having different bits of data stored in different tables and rows ultimately slower, more difficult to manage in the long run and more susceptible to getting 'corrupted' than having it all in one field?</p>
  
  <p>An example block of HTML:</p>
  
  <pre><code>&lt;div class="tab" id="tab1" contenteditable=true&gt;
          &lt;div&gt;
              ly dummy text &lt;span id="1"&gt;of&lt;/span&gt; the pri
          &lt;/div&gt;
          &lt;div&gt;
              ly dummy &lt;span id="2"&gt;text&lt;/span&gt; of the pri
          &lt;/div&gt;
          &lt;div&gt;
              ly &lt;span id="3"&gt;dummy&lt;/span&gt; text of the pri
          &lt;/div&gt;
          &lt;div&gt;
              ly dummy &lt;span id="4"&gt;text&lt;/span&gt; of the pri
          &lt;/div&gt;
          &lt;div&gt;
              &lt;span id="5"&gt;ly&lt;/span&gt; dummy text of the &lt;span id="6"&gt;pri&lt;/span&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>Previously, I would load the whole block of HTML and allow client side functions to do something with the spans. Now, I'm wondering what the drawbacks would be of not only storing the separate <code>tabs</code> but also every child div of that tab and the numerous possible spans within those divs in relationship tables. So, Context > Tab > Div > Span, and the multiple thousands of rows that could result in in a given table. Unfortunately, I am relatively new to programming, so am uncertain about some of these principles. Thank you for your time and patience.</p>