There are three tables (in parentheses):
users (id, username, password, created)
rating (id, username, comment)
comments(id, comment, username, created)
How would I better associate the rating
table with the users
and comments
tables so that each comment has its own rating, and each user also has his rating, just like on this service.
How can you initially set the rating field to 0 by default, and then either increase by 1 or decrease by -1?