Groups | Blog | Home
all groups > sql server data mining > august 2004 >

sql server data mining : Problem with tables


Adam Machanic
8/16/2004 10:31:57 AM

CREATE TABLE UserGroups(UserID INT, GroupID INT)

Now you can insert as many User->Group associations as you want...

You'll also want to define a primary key on (UserID, GroupID) so that you
don't have users in the same group multiple times.

Also, I recommend that you change the names of your 'ID' columns in the
UserDetails and Groups tables. It gets confusing to have the same column
names in different tables with different meanings. Try to keep column names
throughout the database consistent, so that a column named, e.g., 'ColA' in
one table has exactly the same meaning as any other column 'ColA' in any
other table.


[quoted text, click to view]

Nikolay Petrov
8/16/2004 3:40:56 PM
Hi everyone!
I am kind of new to SQL, databases and programing and I have a question,
that looks very easy to me, but I kaind figure it out.
Please help me.
I am designing VB .NET application and underlying SQL database (using MSDE),
and I have two tables:

UserDetails table with columns:
ID
UserName
Password
[other stuff]

and

Groups table with columns:
ID
GroupName

My exact question is, how can I make user member of more then one group?



AddThis Social Bookmark Button