Reputation: 5362
For example, I have a table of Users and a table of Blogs and a separate table called User_To_Blogs which contain only User and Blog IDs.
What are the benefits of such a table as opposed to having a User ID column in the Blog table?
Upvotes: 1
Views: 916
Reputation: 3138
Let's say your blog table has information like blog name, blog start date, blog URL, etc. If you have the user ID in that table, every row will have the same blog information repeated. If you define the blog record in its own table, you define it once and reference it as many times as you want in the user-blog table.
Upvotes: 0
Reputation: 38130
These sorts of tables are useful for many-to-many relationships, where a user can have many blogs, and a blog can have many authors, for example.
Perhaps a better example is the person -> employer relationships, where a person can have worked for many employers, and an employer can have many employees
Upvotes: 3