I am currently creating a blog, I'm about to add comment feature and I have made the table in the DB for it but how do I connect the blogID to the commentID?
I have never tried this so I feel a bit unsecure because I don't want to break the whole db.
Is there any easy way to relate the ids to each other?
I have tried using SQL server 2014 management studio and right-clicked blogID then relationships, however there I could just add blogID, well it was added automatically when I clicked add, so I guess I need to get commentID there in some way?
There is just one blog and won't be more than one. This is what the tables look like:
You should add a BlogID column in your Comments table and add a foreign key constraint (and a non-clustered index) that references BlogId in the Blogs table. You can do that as described here.
BUT, if you have only the one blog and you want the comments per post, you should make a new BlogPosts table and implement the foreign key relationship there to have a more clear schema.