Home > front end >  Is it better to separate a table into two tables in a database schema?
Is it better to separate a table into two tables in a database schema?

Time:10-23

I am making a database schema for my project, but I am still learning, so I'd like to know what the best and most efficient way to go around creating the tables is. Thus:

Should this table be made into two instead of one as shown below? What is the recommended practice?

| movie_id | actor |

to

| movie_id | actor_id | and | actor_id | actor_name |


CodePudding user response:

Depends on how much data Actor is going to encompass, not just now but in the likely future.

Consider:

  • Are you likely to add more than just a name?
  • Are you querying based on the name?
  • Do you need more than one actor per movie?

Since one of those is likely to be true, I'd suggest "yes, split it", but it's a subjective call at this point. It's worth studying normal forms as the relational databases out there tend to lend themselves to those more naturally.

CodePudding user response:

Yes, it's called normalization. Check out this link from Microsoft https://learn.microsoft.com/en-us/office/troubleshoot/access/database-normalization-description

For real-world db applications 3rd normal form is enough.

  • Related