If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Design question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-25-10, 07:38
elmartino elmartino is offline
Registered User
 
Join Date: Oct 2010
Posts: 2
Design question

Hello,

I have a design question.

I'm working on a project where a sports club can add members to it's club. Those members can post thread on a message board.
Now when designing i have the following question.

Lets say i have to following tables: clubs, users, threads

There is an association between the clubs and users table.
Now in the threads table i have a created_by column, is it usual to associate this with only the users table (user_id) or to both the users and the clubs table?

I'm asking this beceause i also want to display a list of started threads for this club. If i only link it to the users table i can work with join statements, but if i link it to both i could also select on the club_id.

I hope someone can help.

Thanks

Elmartino
Reply With Quote
  #2 (permalink)  
Old 10-25-10, 08:04
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Quote:
Originally Posted by elmartino View Post
...is it usual to associate this with only the users table (user_id) or to both the users and the clubs table?
the former

let's say you get a situation where a user changes from one club to another

you would normally (no pun intended) just change the user's club link in the users table and you're finished

but if you have linked the threads table to both users and clubs, then you have an update anomaly -- when a user changes clubs, you would not only have to update the users table, but also the threads table, changing every thread the user is involved in

the pun i made just then was in reference to normalization -- linking to both users and clubs in the threads table breaks third normal form

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 10-25-10, 08:11
elmartino elmartino is offline
Registered User
 
Join Date: Oct 2010
Posts: 2
Thanks for your reply! I will design it that way
Reply With Quote
Reply

Tags
design

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On