![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
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 <----------This table is key, a junction/linking table 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, |
#2
| |||
| |||
|
|
Everything worked fine for this CD extension, I set in up in no time, but I noticed that when a user enters data, sometimes the same combination of Bank Account number and CD identifier (CD ID) will be entered by mistake, which under the below architecture will create a new record. I don't want this. I have various ideas on how to fix this programmically (such as a simple lookup table so when the combination of particular Bank Account and CD ID are found, a warning box will tell the user that this record already exists). However, I can't, under the below architecture, seem to do this via "relationships" in Access. |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
On Dec 29, 5:42 pm, Marshall <marshall.spi... (AT) gmail (DOT) com> wrote: Thanks. I could not get the compound key to work in Access, which is a bit strange (the restriction on whether a foreign key is a duplicate or is unique is rather hidden). After many permutations, I gave up, but it could be a peculiarity of Access. RL |
#5
| ||||
| ||||
|
|
... Now I want to extend this architecture of tables 'schema' is the word you were looking for. |
|
Everything worked fine for this CD extension, I set in up in no time, but I noticed that when a user enters data, sometimes the same combination of Bank Account number and CD identifier (CD ID) will be entered by mistake, which under the below architecture will create a new record. I don't want this. |
|
I have various ideas on how to fix this programmically (such as a simple lookup table so when the combination of particular Bank Account and CD ID are found, a warning box will tell the user that this record already exists). |
|
... tblPersons |
#6
| |||
| |||
|
|
-- What you see depends on where you stand. |
#7
| ||||
| ||||
|
|
On Dec 30, 10:40 am, mAsterdam <mAster... (AT) vrijdag (DOT) org> wrote: -- What you see depends on where you stand. OK wise guy <g>, I kindly beseech thee to give me a simple schema that will do the following: "to declare a uniqueness constraint as a foreign key reference" that allows me to do the following: |
|
Got Access? |
|
LOL. Access is great for rapid coding at the GUI level--you should see what I've come up with in only a few days, but it's kludgey trying to debug stuff. |
|
BTW, I notice a tension between not just front end GUI and back end dB schema people, but between putting data traps and data crunching code in the GUI front end versus writing a SQL query or otherwise dealing with the data in the back end. In fact, some people (the posters at microsoft . public . access . formscoding and elsewhere) imply and state that it's better to deal with this stuff at the front end, since SQL "puts too much load onto the servers" (or in particular Access), a preformance issue, while others, I suspect you guys, think that the front end technique is too much of a maintenance problem or is bad design. RL |
#8
| |||
| |||
|
|
On Dec 30, 10:40 am, mAsterdam <mAster... (AT) vrijdag (DOT) org> wrote: -- What you see depends on where you stand. OK wise guy <g>, I kindly beseech thee to give me a simple schema that will do the following: "to declare a uniqueness constraint as a foreign key reference" that allows me to do the following: Table Certificate of Deposit provides a series of fixed income products (CDs, Bonds, notes, etc, that are portable, in that you can deposit them anywhere)--hereinafter "CD". Primary key right now is "CD SYmbol" (alphanumeric designator of the product: XYZABC_Bond_matures_2008) Table Bank has a primary key comprising: An account number that is unique to every person--hereinafter "Bank" Now I want to create a junction table called "AccountCD" that combines the primary key of both the two tables above. I do this, but unfortunately in Access I cannot enter a combination of "CD" and "Bank" that is unique. THat is, either the table allows me to enter the same CD with the same Bank twice***, or, if I play around with the keys, it forbids me from entering either (1) the same bank twice or (2) the same CD twice. BTW, this last restriction (1) I can live with, but I don't want it--that is, I can set up a AccountCD table that has only one record per bank, and different CDs in the record, but what I want (because I'm too lazy to change my schema now) is a series of unique combinations of records comprising: "BankA + CD 123", "BankA + CD ABC", "BankB + CD 123", "BankB + CD ABC", but not "BankA + CD 123" twice. Got it? If it helps, my relationships flow 1 to many from CD/Bank (one) to AccountCD (many). *** That is, the way the schema is now, I can enter any combination of bank and CD I want, without restriction, even if it's a double: ie., "BankA + CD 123", "BankA + CD 123". Got Access? LOL. Access is great for rapid coding at the GUI level--you should see what I've come up with in only a few days, but it's kludgey trying to debug stuff. BTW, I notice a tension between not just front end GUI and back end dB schema people, but between putting data traps and data crunching code in the GUI front end versus writing a SQL query or otherwise dealing with the data in the back end. In fact, some people (the posters at microsoft . public . access . formscoding and elsewhere) imply and state that it's better to deal with this stuff at the front end, since SQL "puts too much load onto the servers" (or in particular Access), a preformance issue, while others, I suspect you guys, think that the front end technique is too much of a maintenance problem or is bad design. |
#9
| ||||||
| ||||||
|
|
OK wise guy <g>, I kindly beseech thee to give me a simple schema that will do the following: "to declare a uniqueness constraint as a foreign key reference" that allows me to do the following: |
|
Table Certificate of Deposit provides a series of fixed income products (CDs, Bonds, notes, etc, that are portable, in that you can deposit them anywhere)--hereinafter "CD". Primary key right now is "CD SYmbol" (alphanumeric designator of the product: XYZABC_Bond_matures_2008) Table Bank has a primary key comprising: An account number that is unique to every person--hereinafter "Bank" |
|
Now I want to create a junction table called "AccountCD" that combines the primary key of both the two tables above. |
|
I do this, but unfortunately in Access I cannot enter a combination of "CD" and "Bank" that is unique. |
|
THat is, either the table allows me to enter the same CD with the same Bank twice***, or, if I play around with the keys, it forbids me from entering either (1) the same bank twice or (2) the same CD twice. BTW, this last restriction (1) I can live with, but I don't want it--that is, I can set up a AccountCD table that has only one record per bank, and different CDs in the record, but what I want (because I'm too lazy to change my schema now) is a series of unique combinations of records comprising: "BankA + CD 123", "BankA + CD ABC", "BankB + CD 123", "BankB + CD ABC", but not "BankA + CD 123" twice. Got it? If it helps, my relationships flow 1 to many from CD/Bank (one) to AccountCD (many). *** That is, the way the schema is now, I can enter any combination of bank and CD I want, without restriction, even if it's a double: ie., "BankA + CD 123", "BankA + CD 123". Got Access? |
|
LOL. Access is great for rapid coding at the GUI level--you should see what I've come up with in only a few days, but it's kludgey trying to debug stuff. BTW, I notice a tension between not just front end GUI and back end dB schema people, but between putting data traps and data crunching code in the GUI front end versus writing a SQL query or otherwise dealing with the data in the back end. In fact, some people (the posters at microsoft . public . access . formscoding and elsewhere) imply and state that it's better to deal with this stuff at the front end, since SQL "puts too much load onto the servers" (or in particular Access), a preformance issue, while others, I suspect you guys, think that the front end technique is too much of a maintenance problem or is bad design. |
#10
| |||
| |||
|
|
BTW, I notice a tension between not just front end GUI and back end dB schema people, but between putting data traps and data crunching code in the GUI front end versus writing a SQL query or otherwise dealing with the data in the back end. In fact, some people (the posters at microsoft . public . access . formscoding and elsewhere) imply and state that it's better to deal with this stuff at the front end, since SQL "puts too much load onto the servers" (or in particular Access), a preformance issue, while others, I suspect you guys, think that the front end technique is too much of a maintenance problem or is bad design. |
![]() |
| Thread Tools | |
| Display Modes | |
| |