At 12:54 PM 12/16/2006, you wrote:

Hiya,

Real easy quick question.
I need to design a database which holds users with email, name and some
other details.
I also want each user to be able to create one or more groups of users,
owned by themselves.
What would be the best design approach?

So far i have a table for the users which stores their personal details, but
i dont know where to go from here to create the groups? Create a new table
for every group? The group would just contain a list of the users emails in
that group.
Or would i create a new table for the groups and attach a password field on
it so only the user that created it could access it?

A very newbie question i know, but i am one, i'll admit it.

Any help would be apprectiated.

Thanks

John
--
View this message in context: http://www.nabble.com/database-design-help-tf2832533.html#a7908028
Sent from the MySQL - General mailing list archive at Nabble.com.

Presumably users is something like this:
Members table
ID - numeric, auto-generated
BelongsTo - group id
Firstname
Surname
email
phone
etc.

But that's not right - A User can belong to only one group, most probably want to belong to many - so remove the BelongsTo field and let a refernce to the ID field of the membertable do the work

GroupMembers table

ID - numeric, autogenerated
Group_ID - numeric, foreign key
Member_ID - numeric, foreign key - refers to ID field in Members table

and of course a Groups table,

ID - numeric, autogenerated
Managed_By - foreign key, refers to ID field in Members table
Name
other pertinent stuff


There you go - three tables able to hold unlimited combinations of groups and members and you will never have a many to many problem.

Cheers - Miles

other info .






--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.15.21/589 - Release Date: 12/15/2006



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to