Yes, I did last night, but wasn’t getting it.
because if a comment belongs to an article and is also associated with a member (the one who made the comment), then the PK of the comment table would be article_id plus member_id
Right.
so if other members can vote on the comment, therefore you need a second member_id in the vote table
so the PK of the vote table would be article_id plus member_id (who wrote the comment) plus member_id (who made the vote)
so your vote table would have two member_id columns, and you wouldn’t of course be able to give both of these columns the name “member_id”
in a similar way, in a database which keeps track of sports games, the games table has two team_id columns, one is often called home_team_id and the other away_team_id
Okay, I wasn’t seeing that!
Here is a dump of my tables…
article
Field Type Null Default Comments
id mediumint(8) No
title varchar(250) No
subtitle varchar(250) Yes NULL
article_date date No
author varchar(100) Yes NULL
body text No
end_notes text Yes NULL
created_on datetime No
updated_on datetime Yes NULL
comment
Field Type Null Default Comments
article_id mediumint(8) No
member_id mediumint(8) No
body text No
status varchar(20) No
created_on datetime No
approved_on datetime Yes NULL
updated_on datetime Yes NULL
member
Field Type Null Default Comments
id mediumint(8) No
email varchar(40) No
pass char(40) No
first_name varchar(20) No
vote
Field Type Null Default Comments
article_id mediumint(8) No
member_id mediumint(8) No
voting_member_id mediumint(8) No
score tinyint(4) No
created_on datetime No
updated_on datetime Yes NULL
Indexes:
Keyname Type Cardinality Field
PRIMARY PRIMARY 0 article_id, member_id, voting_member_id
How does that look?
Debbie