Home>

Advantages and disadvantages of managing DB columns separately
What are the advantages and disadvantages of keeping one?
As a premise, the HTML source is stored in the DB as it is and displayed.

For example


The current time is 12 o'clock.
<Dib>
  <table>
    <tr>
      <th>time</th>
      <td>Schedule</td>
</Tr>
    <tr>
      <th>time</th>
      <td>Schedule</td>
</Tr>
    <tr>
      <th>time</th>
      <td>Schedule</td>
</Tr>
  </table>
  

Assuming there is something templated like this
If I want to return the contents of "aaa" and "aaa_table" in the same way every time you add data
How to store columns separately by "aaa" and "aaa_table" instead of putting them in one column in DB
I would like to know if there are advantages and disadvantages of putting all "aaa" and "aaa_table" (the above code) in one column.


● Your own consideration
Advantages and disadvantages of separating columns
Merit: When deleting all specific information, it is easy to deal with it because it is sufficient to delete each column.
Easy to handle changes in the number of data
Disadvantage: If i crush it in detail, it will be a huge amount and man-hours.

Advantages and disadvantages of using one column
Advantage: Easy to flow data
Disadvantage: It is difficult to operate for a specific section. (I want you to hide only part of it, etc.)


It is an image. (I'm sorry if it's hard to convey.)
● One column

id contents contents
1 The current time is 12 o'clock.~~~

● Separate columns

id contents contents sub_contens
1 The current time is 12 o'clock.
time

I would like to use it as a reference, so thank you.

  • Answer # 1

    Assuming there is something templated like this

    If it is a template, in general, the contents such as "12 o'clock", the contents of each time and scheduleOnlyIt is something to keep in the database.

    The structure to put each HTML is only done in the situation such as "Since each page is a blog that is completely different from the structure, keep everything in HTML".