Need help with tables structure

maxim

Registered User.
Local time
Today, 17:03
Joined
Aug 1, 2008
Messages
13
Hi,
I’m working on the database to reconcile stock trade and cash for retirement fund. We receive checks from our clients which we need to invest. These deposits are logged into database and clerk orders purchase of different funds. This is a contribution. If client wants his money back we sell the fund and send them a check – a distribution. In the end balance in the bank will remain zero since deposits will go out to pay for purchase of the funds and money raised from the sale of the fund will be sent back to the client.
I decided to store Contributions and Distributions in two separate tables because they have too many differences. When Contributions or Distributions gets processed the trade is being ordered. There are 3 kinds of trades: buy dollars, sell dollars and sell shares. Contributions always produce Buy Dollars trade. Distribution can produce ether Sell Shares or Sell Dollars Trade.
My problem is that I need report that combines Contribution and Distribution trades. To solve the problem I created multiple append queries that will break down information entered in Contributions and Distributions tables into trades based on their properties in the following format: Amount, Buy/Sell, Dollars/Units, Contribution/Distribution. Then I run the report based on this new table and clear table with delete query after.
Any input will be appreciated.
 

Attachments

  • img1.JPG
    img1.JPG
    79 KB · Views: 166
I think the relationship between contributions and deposits is backwards based on your description of what they are.

I don't see the temp tables you are using for reporting but in general, temp tables can be avoided by using nested queries.

As far as the tables are concerned - you have not been consistant in your naming convention for primary and foreign keys. You have columns and tables with spaces in their names and you have columns with special characters in their names.

Thanks. I will look into replacing temp table with nested query.

What kind of problem can primary/foreign key inconsistency cause?
 

Users who are viewing this thread

Back
Top Bottom