I have a database that stores information on government bonds. These need to be classified into 3 categories based on time to maturity: 1) Short Term 2) Medium Term and 3) Long Term.
Since a bond’s classification can change as its maturity nears I set up a simple IIF based formula that compares the bond’s maturity to the current date and then assigns it a value i.e. 1, 2, or 3. I plan to link this with a table called AssetClassID which will have the values in one column and their text descriptions in another column.
My question involves how to structure the table correctly. Specifically whether I should create a third column that holds an autonumber PK field. This column would be meaningless other than making each record unique. Or I should make the value fields (1, 2, or 3) the PK and leave it at that. I think I should have the additional PK field.
Structure 1
AssetClassID (PK, autonumber)
AssetClassNumber (FK to query, number)
AssetClassDescription (text)
Or
Structure 2
AssetClassNumber(PK and FK to query, number)
AssetClassDescription (text)
My dilemma is because I know every table should have an autonumber PK field. And even though it may not be logical I feel like I want control over the AssetClassNumber field since my IIF statement is based on it. This tells me I should use Structure 1. But at the same time it seems unnecessary to have the extra field.
I plan on doing this a couple of places in the database so I guess I am looking for confirmation that my planned method of attack makes sense.
For example, corporate bonds have a range of 9 lettered ratings and I want to have an IIF statement to classify them as Investment grade or Speculative grade. So I thought I would give each letter a number (1-9) and then the IIF statement could say if it was < 5 Investment Grade and >= 5 Speculative Grade. Once again would I need the extra PK field in my table? And is it okay to base the IIF statements of the AssetClassNumber column where I control the numbers?
It is always nice to have another opinion.
Dwight
Since a bond’s classification can change as its maturity nears I set up a simple IIF based formula that compares the bond’s maturity to the current date and then assigns it a value i.e. 1, 2, or 3. I plan to link this with a table called AssetClassID which will have the values in one column and their text descriptions in another column.
My question involves how to structure the table correctly. Specifically whether I should create a third column that holds an autonumber PK field. This column would be meaningless other than making each record unique. Or I should make the value fields (1, 2, or 3) the PK and leave it at that. I think I should have the additional PK field.
Structure 1
AssetClassID (PK, autonumber)
AssetClassNumber (FK to query, number)
AssetClassDescription (text)
Or
Structure 2
AssetClassNumber(PK and FK to query, number)
AssetClassDescription (text)
My dilemma is because I know every table should have an autonumber PK field. And even though it may not be logical I feel like I want control over the AssetClassNumber field since my IIF statement is based on it. This tells me I should use Structure 1. But at the same time it seems unnecessary to have the extra field.
I plan on doing this a couple of places in the database so I guess I am looking for confirmation that my planned method of attack makes sense.
For example, corporate bonds have a range of 9 lettered ratings and I want to have an IIF statement to classify them as Investment grade or Speculative grade. So I thought I would give each letter a number (1-9) and then the IIF statement could say if it was < 5 Investment Grade and >= 5 Speculative Grade. Once again would I need the extra PK field in my table? And is it okay to base the IIF statements of the AssetClassNumber column where I control the numbers?
It is always nice to have another opinion.
Dwight