fogofogo
11-06-2007, 01:11 PM
Hello all
I have been asked to create a database that has a users table, news table and a groups table. I'm new to this so I'm having a bit of difficulty mapping out the database design, and was hoping someone here could offer some input.
The idea is that the users will add their own news stories, and assign the stories to certain groups that HAVE been set (default groups) for them already like friends/work/public. But the users can ALSO create extra groups if they need to. So my problem is figuring out the best structure for the group’s table.
What I have come up with is this...
Users Table
===========
UserID UserName
1 John
2 Mike
3 Sarah
Groups Table
============
GroupID Group Type UserID
1 Public 1
2 Work 1
3 Friends 1
4 Public 2
5 Work 2
6 Friends 2
7 Public 3
8 Work 3
9 Friends 3
10 FAMILY 2
(you'll notice that mike created his new group called family. The other groups will be automatically created when a new user is added to the system. Their new USERID will be assigned to a public, work and family groupID)
News Table
==========
NewsID UserID GroupID NewsStory
1 3 8 Blah, blah news...
2 3 3 Blah, blah news...
3 2 2 Blah, blah news...
4 1 2 Blah, blah news...
(Each user will be able to assign his/her news story to a certain group)
So my concern is the group’s table. There’s a lot of data repeating itself, but I can't think of a good way to store newly added groups by users. Is there a better way of doing this?
Thanks for your help!
I have been asked to create a database that has a users table, news table and a groups table. I'm new to this so I'm having a bit of difficulty mapping out the database design, and was hoping someone here could offer some input.
The idea is that the users will add their own news stories, and assign the stories to certain groups that HAVE been set (default groups) for them already like friends/work/public. But the users can ALSO create extra groups if they need to. So my problem is figuring out the best structure for the group’s table.
What I have come up with is this...
Users Table
===========
UserID UserName
1 John
2 Mike
3 Sarah
Groups Table
============
GroupID Group Type UserID
1 Public 1
2 Work 1
3 Friends 1
4 Public 2
5 Work 2
6 Friends 2
7 Public 3
8 Work 3
9 Friends 3
10 FAMILY 2
(you'll notice that mike created his new group called family. The other groups will be automatically created when a new user is added to the system. Their new USERID will be assigned to a public, work and family groupID)
News Table
==========
NewsID UserID GroupID NewsStory
1 3 8 Blah, blah news...
2 3 3 Blah, blah news...
3 2 2 Blah, blah news...
4 1 2 Blah, blah news...
(Each user will be able to assign his/her news story to a certain group)
So my concern is the group’s table. There’s a lot of data repeating itself, but I can't think of a good way to store newly added groups by users. Is there a better way of doing this?
Thanks for your help!