groups database
Moderator: General Moderators
groups database
hi, i have created so far 3 tables for a groups site (like yahoo grouops) namely userprofile, groupsprofile and groupsmessage...i was thinking how and where i can put additional fields...i'm confused, here's the catch...in a single account, a user might have multiple groups to join, now, i cant figure out how i can make the logic in the database...should i add additional field in the userprofile table??or should i create another table for this...i don't really know much about mysql and logic structure for larger project...i hope u can help me...thanks in advance.. 
If you'd like to study up on this problem and solution then look up "Database normalization" over the net.
In short, it looks like you'll need at least 4 tables :
1. User_db -A table to hold unique information about the user.
2. Groups_db -A table to hold unique information about the groups.
3. GroupMembers_db -A table to connect users to groups.
4. Messages_db -A table to relate Messages to Users and Groups.
User_db would then have a unique primary key to indentify each unique row (each user).
Groups_db would have a unique primary key for each row (each group).
GroupMembers_db would would have a unique primary key for each row as well as foreign keys relating back to Groups_db and User_db and connects which users belong to which groups.
Message_db would have a unique primary key for each row (each message) as well as a foreign key relating back to GroupMembers_db.
Get the idea?
In short, it looks like you'll need at least 4 tables :
1. User_db -A table to hold unique information about the user.
2. Groups_db -A table to hold unique information about the groups.
3. GroupMembers_db -A table to connect users to groups.
4. Messages_db -A table to relate Messages to Users and Groups.
User_db would then have a unique primary key to indentify each unique row (each user).
Groups_db would have a unique primary key for each row (each group).
GroupMembers_db would would have a unique primary key for each row as well as foreign keys relating back to Groups_db and User_db and connects which users belong to which groups.
Message_db would have a unique primary key for each row (each message) as well as a foreign key relating back to GroupMembers_db.
Get the idea?