2

Very new to database management here. I'm trying to figure out what rule of thumb I should be following when it comes to making separate tables for data rather than just labeling it as different within the same table

say I have a fleet of robots. I could have tables that differentiate foodmaking robots from cleaner robots, killer robots, etc. or I could have a table of robots with a field that specifies the type of robot it is. which is better and why?

1

In my opinion, It is very much depends on the details.

  • Does cleaner robot has different attributes compare to killer robot?
  • Do you have different type of killer/cleaner robots?

if your answer to any of these questions is yes, Then probably you need a separate table for each type (Normalization). Using different table for different type simplifies your job when you want to extend your application. Attributes with functional dependency (2nd Normal Form) and transitive dependency (3th Normal Form) need to be placed in the same table. You may read more about pros and cons of normalization.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.