I have a table with different sorts of things. The thing is that there are columns that just some of the rows fill with data. Because the other rows doesn’t need that. Is it bad to have some cells empty? Should I store all of then in different tables and have a main table where columns that all objects need are? And then when I want to select something I do joins instead?
Share
From the little information you have provided, this might be a case of storing information about different types of objects in one table, like cars, people, houses etc.
And forgive me in advance for my overly simplistic example, could not think of a better one.
People have attributes like name, family name, birth date. Cars have attributes like brand, color, number of doors, engine volume etc. Houses have area, number of bedrooms, garden (yes or no) etc.
When such a table would be populated with entries, it would look like this:
1 means cell has some data, 0 means cell is empty.
If your table looks like this, you might be better off splitting your table into more tables, as database normalization suggests.