| | |
Database/table structure for points system
Please support our Database Design advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
I'm trying to make a membership system where users can 'approve' or 'disapprove' another member only once. If they have approved the member previously or disproved the member previously, I want to be able to detect it.
I also want to display the average user approval for each member on their profile. (# of approvals/ # of approval+disapproval received)
I'm thinking of having 2 tables:
1. The `members` table - basic user info
2. The `ratings` table - each row is an entry for when user#1 votes (+ or -) for user#2.
My concern is this:
1. Is this the most efficient way to implement such a system? If not, can you please suggest a better way to do it?
2. Will it take up too much resources if I have to query the ratings table everytime I have to fetch the average rating?
Thanks for helping me. *in advance haha*
I also want to display the average user approval for each member on their profile. (# of approvals/ # of approval+disapproval received)
I'm thinking of having 2 tables:
1. The `members` table - basic user info
2. The `ratings` table - each row is an entry for when user#1 votes (+ or -) for user#2.
My concern is this:
1. Is this the most efficient way to implement such a system? If not, can you please suggest a better way to do it?
2. Will it take up too much resources if I have to query the ratings table everytime I have to fetch the average rating?
Thanks for helping me. *in advance haha*
•
•
•
•
users can 'approve' or 'disapprove' another member
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Eep. Sorry for switching terms... Users are the same as members.
If you know ASP, you can save other daniweb members from idiots like me by helping out in this forum.
Visit this thread if your username starts with one of the following letters: B D F H J L N P R T X Y Z.
Visit this thread if your username starts with one of the following letters: B D F H J L N P R T X Y Z.
[User] table still the same
[Rating] table has (Voter_Member int #, Voted_Member int #, Rating int)
- Composed primary keys (to maintain user can't de\vote user two times)
- Rating int (if you need some higher rating 1 2 3 4 or -1 -2 -3 -4)
[Rating] table has (Voter_Member int #, Voted_Member int #, Rating int)
- Composed primary keys (to maintain user can't de\vote user two times)
- Rating int (if you need some higher rating 1 2 3 4 or -1 -2 -3 -4)
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
*googles primary key... 0.0*
So I have to set voted_memberID and voter_memberID as primary keys?
Yey! Thank you so much for the advice. ;-)
So I have to set voted_memberID and voter_memberID as primary keys?
Yey! Thank you so much for the advice. ;-)
If you know ASP, you can save other daniweb members from idiots like me by helping out in this forum.
Visit this thread if your username starts with one of the following letters: B D F H J L N P R T X Y Z.
Visit this thread if your username starts with one of the following letters: B D F H J L N P R T X Y Z.
![]() |
Similar Threads
- Using OpenGL in Visual C++: Part I (Game Development)
- XML and hyperlink as one of the data (RSS, Web Services and SOAP)
Other Threads in the Database Design Forum
- Previous Thread: How to Collect data from Alexa ?
- Next Thread: Many to many relationship
| Thread Tools | Search this Thread |






