
Question:
I want to create a group function on my site and I'm wondering what the best way to do this would be? would i be best to create two tables groups and group_members? im fairly new to sql so im not so sure.
im thinking this:
groups group_id int(11) NOT NULL auto_increment, group_name varchar(32) NOT NULL
group_members id int(11) NOT NULL auto_increment, group_id int(11) NOT NULL user_id int(11) NOT NULL
users id int(11) NOT NULL auto_increment username varchar(24) NOT NULL password varchar(32) NOT NULL
would that be the best? or is there a better way?
Cheers boys
EDIT: CHECK MY LAST MESSAGE FOR ANOTHER QUESTION :)
Solution:1
That is how I would do it.
Another option would be to put a group_id column in the users table, but if you do that you'd be restricting yourself to only one group per user. The way you are doing it allows a many to many relationship, which I think is the best route to go :o)
Solution:2
Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
EmoticonEmoticon