Results 1 to 11 of 11
Thread: Re-thinking my Primary Key
Jun 18, 2012, 02:43 #1
- Join Date
- Aug 2010
- 2 Post(s)
- 0 Thread(s)
Re-thinking my Primary Key
I have a "comment" table which is the junction table in a many-to-many relationship between the "member" and "article" tables.
Here are my tables...
- id (pk)
- member_id (pk)(fk)
- article_id (pk)(fk)
- created_on (pk)(fk)
- id (pk)
Currently I am adding in the ability for people to "Report a Comment" from a given Article page, which necessitates me passing over the "Article ID", "Member ID", and "Created On Date" to my "report_comment.php" script.
(For any given Article, the same Member could have posted several Comments, so I need all three pieces of information to know *which* Comment the person is reporting.)
Simply put, that is a PITA...
And so i am wondering if this might be a good reason to add an auto-increment "comment.id" field, and make that my Primary Key?!
Do so would most certainly make my life easier as far as this script I am working on.
I'm not sure how it might impact other things I might need to do in the future?!
Currently, I can't think of any places where I am actually using my 3-Key Primary Key other than for ensuring uniqueness in the table...