0

Let's imagine we have two categories of publications - movies and books. Is it better to create one MySQL table for all publications or two different tables and unite them every time we show them in the united feed?

EDIT: The structure is little different. it has some common and uncommon data

  • 1
    If the structure is exactly the same its unnecessary to built two different tables, just adding a column type will be better – sagi Feb 21 '16 at 15:38

1 Answers1

0

Assuming both categories got the same attributes, there is no difference in query performance (According to Multiple Table Select vs. JOIN (performance) ) In that case the solution with one table uses slightly more storage than the two table solution as you need a further column for differentiation (e.g. type).

EDIT

As your structure is different, you should use the two-table-solution as you get NULL fields if you use the one-table-solution.

A bad example for the table Publications:

enter image description here

In the given example you do not need an additional attribute to differentiate the two types because you could determine the type by Pages or Director.

You should avoid NULL values, especially when they are not meant to be filled with data in the future.

Community
  • 1
  • 1
SevenOfNine
  • 630
  • 1
  • 6
  • 25