I am trying to make a comment section for products. I am setting two primary keys, the CommentID
and the ProductID
for the Comments
table. But what I want to do with the primary keys is as follows: for each ProductID
, the CommentID
should start counting from the beginning. So for ProductID = 1
, the CommentID
should start from 1 and be incremented, for ProductID = 2
, the CommentID
should also start from 1 and be incremented, and so on. Same time the ProductID
is the foreign key that points on Product table.
Can someone guide me how to archive that, is it a good practice or does a better workaround exist except making two primary keys?
Thank you!