Jump to content

Best way to structure sql database for records that will have group#, & member#?


Recommended Posts

I am working on a script that will need to write data to many "users" assigned to different "groups". From the same page, but it will write to only one group at any "submit" button click.

 

Which group/member # to be written to will be chosen based on user input.

 

Which one of the following options is best for me to structure the sql database:

 

1) One table that has for each record; a group number, and a globally unique member number?

 

OR

 

2) A table for each group #, and and each member number is unique only to that table?

 

OR

 

3) A different option that I am missing.

 

In theory, the amount of records database wide, can grow to be in the tens of thousands.

 

Thanks

Your options aren't exactly clear to me. Here's my input if I understand you correctly -

 

Table group

id PK

group_name

 

Table member

id PK

member_name

 

Table membergroup

id

member_id FK

group_id FK

 

Assuming a member can have more than one group, that's how I would do it. Sorry if that's not what you meant.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.