I am creating a simple blog app and so far I have 3 tables, Posts, Comments, and Authors.
I will just list the primary key for each table as well as a foreign key.
Posts will contain postid as a primary key.
Comments will contain commentid as a primary key and postid as a foreign key.
Posts has a 0 to many relationship with comments.
Authors will contain an authorid as a primary key.
Authors will have a many to many relationship with posts and a many to many relationship with comments.
The last statement is where I am having the most trouble. Does authors actually have a many to many relationship with posts and comments since or is it a one to one. If it is a many to many, I have heard that it is a good idea to have an in-between table describing the relationship between posts-authors and comments-authors, but I am not sure what keys I would use in this table?
If I verbally express it as an author can write many posts and many posts can be written by one author, I see it as a one to many, but if I view it from the actual data stored in the tables such as posts will contain multiple posts and authors will contain multiple authors, then it seems like a many to many, so is this what the cross-reference table is for, to remove duplicates.