I am creating a mortgage/loans database - I have a table called mortgages with the fields:
- mortgage_id
- client_id
- *rate_type* (which may be: fixed or tracker) ...etc
Depending on the choice for rate_type - the fields that follow will be different. For instance, if a mortgage with a fixed rate_type is selected, then the user will only enter that fixed rate. If it is a tracker mortgage, then a track rate e.g. +0.90% and a base rate(which is being tracked) e.g. 0.50% is needed[giving adjusted rate = 1.40%].
My question is: how can I go about implementing the correct table/field structure for this. Ideally I don't want to have all the the fields (highlighted):
- mortgage_id
- client_id
- rate_type
- fixed_rate
- track_rate
- base_rate
Because it could lead to confusion. Is there any way to separate these into other tables? Perhaps another table with the rate_details (one for fixed and another for tracker) with a one-to-one relationship?
based on your question, i'd suggest that you can create 3 tables.
1 for the Basic information, a table for storing details on fixed rates, and a table for storing details about base rates.
tblMortgages:
MortgageID | client id | rate type
tblFixedRates:
id | mortgageID | fixed_rate
tblTrackerRates:
id | mortgageID | track_rate, base_rate