By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,917 Members | 1,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,917 IT Pros & Developers. It's quick & easy.

Relationships and tables

P: n/a
I am creating a db for users in a company, each user uses different
programes (a choice of 5) some may use one and some may use many, each
program has different settings and in the db has a table of its own. a
user is identified by a unique username, tables so far

User_table
username*
name
email
phoneno etc

Prog1_table
auto_no*
username
settings

Prog2_table
auto_no*
username
settings

etc..

My q is should i have a join table? How should i make this a tidy db? I
want to be able to query on the number of programs a user uses. What
should my relationships be?

Cheers

Apr 24 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,
First of all you shall create one table for all your program like that:

Programs_Table
program_num ** can be 1 to 5 or etc.
settings ** if this field is constant for all users and not relate to
any user in special so it will be in this table.

Another table:

Program_To_User:
username
program_num

You shall create the relationship like that:
User_Table->username to Program_To_user->username (many to many).
Programs_Table->program_num to Program_To_user->program_num (many to
many).

Hope I Helped, Haim Rubin.

Apr 24 '06 #2

P: n/a
Br
missboom wrote:
I am creating a db for users in a company, each user uses different
programes (a choice of 5) some may use one and some may use many, each
program has different settings and in the db has a table of its own. a
user is identified by a unique username, tables so far

User_table
username*
name
email
phoneno etc

Prog1_table
auto_no*
username
settings

Prog2_table
auto_no*
username
settings

etc..

My q is should i have a join table? How should i make this a tidy db?
I want to be able to query on the number of programs a user uses. What
should my relationships be?

Cheers


I suggest you do some research into database design. If your data is
properly normalised you'd similar data in the one table. Come from an Excel
background??? :)

eg.

Users
--------
UserID
Username

UserPrograms
--------------------
UserID
ProgramID
UserProgramSettings

Programs
--------------
ProgramID
ProgramName
ProgramDefaultSettings (could be useful?)

Hope that guides you a little in the right direction.
--
regards,

Br@dley
Apr 24 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.