database 'practice' question

From: emma middlebrook <emma_middlebrook_at_fastmail.fm>
Date: 20 Nov 2002 03:52:59 -0800
Message-ID: <e27ae805.0211200352.5329205d_at_posting.google.com>



This was the most relevant newsgroup for my query despite its title and despite my question! I hope someone can help ...

This is the setup.

We have some people (traders). A person may have many accounts (accounts). Each account has many transactions (trades) associated with it.  

Trying to think which is 'better' and why: to include TraderID as a foreign key of Accounts or to have a *separate* table which contain the 'links' between traders and accounts. I can't work out really why you'd have one over the other and for what reasons? I mean, you could argue that the trader who owns the account is nothing to do with the account itself and so should be in a different 'look-up' table. How would you think about it?

Many thanks for any replies or explanations.

Emma  

i.e.  

Traders



TraderID
TraderName
...  

AND  

Accounts          OR   Accounts AND TradersAccounts
========               ========     ===============
AccountID              AccountID    TraderID
TraderID               Balance      AccountID
Balance  

AND  

Trades            OR   Trades   AND     other tables like 
======                 ======           AccountsTrades 
TradeID                TradeID          TradersTrades
AccountID              Description
TraderID               ProfitLoss
Description           

ProfitLoss Received on Wed Nov 20 2002 - 12:52:59 CET

Original text of this message