Re: A newbie paradox: is this a PK-FK (relationship) problem, or programming problem?

From: raylopez99 <raylopez99_at_yahoo.com>
Date: Sun, 23 Dec 2007 03:43:46 -0800 (PST)

On Dec 22, 4:38 pm, "tina" <nos..._at_address.com> wrote:

Thanks Tina! I like your solution, it seems to make sense and even be in Third Normal Form or somesuch...very nice!

I will model it and if I have any problems will report back.

RL

> tblPersons
> PersonID (pk)
> FirstName
> MiddleInitial
> LastName
> <other fields that describe the person only.>

> tblStocks
> StockSymbol (pk)
> StockName
> <other fields that identify the stock only.>

> tblBrokerages
> BrokID (pk)
> BrokName

> tblAccounts
> AcctID (pk)
> PersonID (fk)
> BrokID (fk)
> <other fields that describe a specific account for a specific person.>

> tblAccountStocks
> AcctStockID (pk)
> AcctID (fk)
> StockSymbol (fk)

> tblTransactions
> TransID (pk)
> AcctStockID (fk)
> <other fields that describe a specific transaction of a specific stock in a
> specific account.>

> the relational structure is
> tblPersons.PersonID 1:n tblAccounts.PersonID
> tblBrokerages.BrokID 1:n tblAccounts.BrokID
> tblAccounts.AcctID 1:n tblAccountStocks.AcctID
> tblStocks.StockSymbol 1:n tblAccountStocks.StockSymbol
> tblAccountStocks.AcctStockID 1:n tblTransactions.AcctStockID

> tblAccounts is a junction (linking) table between tblPersons and
> tblBrokerages.
> tblAccountStocks is a junction (linking) table between tblAccounts and
> tblStocks.
> and tblTransactions is a simple child table of tblAccountStocks.
> so you can trace each transaction record back to a specific stock in a
> specific account belonging to a specific person.

> i don't know a thing about stock markets and trading, so i imagine this is a
> simplified structure,
Received on Sun Dec 23 2007 - 12:43:46 CET

Original text of this message