View Full Version : Choice list vs Several lines


Leito
04-13-2010, 01:01 AM
Hello,

I have a question regarding my database structure. I have done some SQL before, but that's the first time I'm using Access.

First, let me show (some scheme will be better than a long paragraph) you the tables I got:


Groups
__________________
group_id | group_name


Users
____________________
user_id | login | groups_id


As you can see, I have two tables: one where groups are stored, one where users are stored. A user can be a member of one or several groups. So there is a relation between groups_id [Users] and group_id [Groups].

My question is: Is it better to create several lines in [Users] if a user belong to several groups (I mean one line per group), or is it better to set the groups_id field as a Choice list (this way I will only have one line for one user) ? Just for you to know, I plan to use SQL queries in some C# code to exploit that database.

I just discovered the "Choice List" possibility in Access, that's why I have that question in mind.


Thanks in advance! :)

namliam
04-13-2010, 01:08 AM
One user, many groups, one group many users

This is a clasical m:n relationship that should be solved using a junction table:
JunctionTable
User_ID | Groups_ID

This table then solves your problem

Leito
04-13-2010, 01:34 AM
That's right! Thank you for that response! :)