If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > database design on a transaction system

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-27-04, 14:51
john11 john11 is offline
Registered User
 
Join Date: Jan 2003
Posts: 6
Question database design on a transaction system

Man, Do I need help. I have been redesigning (hoping to improve) a database that I developed. I have been at it for a month and still am unsure about some basic aspects of my design. Even if it means hiring someone to help, I am drowning fast.

Brief description:
Sort of like software that would be used at a bank.
This needs to be fully transactional, i.e. every creation of, or change to a previously created transaction, must result in a separate transaction. I export all transactions not previously exported, to a different system, on demand.
Example: A deposit is created for an account. That deposit transaction is exported. If a change is required to the original deposit transaction, a new transaction must exist that can also be exported.

There are 2 additional fundamental requirements:
1. Users to be able to see all transactions for an account, in datetime order.
2. Users should able to view any original transaction along with any adjustments to that transaction.

This is what I have. I use surrogate keys:

Accounts - 1 rec per account. Information about the account.
cId (surrogate/primary key)
blah...blah...blah...

Account_Txns - 1 rec per transaction per account.
cId (surrogate/primary key)
cAccounts_Id (points to cid in Accounts)
cTxn_Type - There are Deposits, Purchases, Checks written, Deposit Adjustments, Purchase Refunds and Purchase Returns, Voided Checks, etc. basically many transactions and many adjusting transactions.
tTxn_DateTime
cTxn_UserId
blah...blah...blah...

Basically there is a table for Deposits, one for Deposit_Adjustments, one for Purchases, one for Purchase_Refunds, Purchase_Returns, Checks_Written, Voided_Checks, etc., each of which contains info specificto that type of transaction. Each transaction in these tables has apointer to the releated Account_txns record. I believe that is 1 to 1 and that worries me.

My quandry: Account_Txns has me totally perplexed. Is it in 3rd normal form? Should it really exist or should Deposits, Purchases, Checks Written, Deposit_Adjustments, etc be related directly to Accounts and Account_Txns is just a view by unioning all the tables. This is so basic to the design I know I must get it right. Unions are difficult (at least for me) so perhaps Account_Txns is a compromise. If so I have to know it will "be ok".

Thanks,
John Cook
Bulletproof Software
Reply With Quote
  #2 (permalink)  
Old 04-27-04, 15:27
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
if you want more info, search for the terms "subtype and supertype"

i would always minimize database complexity while at the same time minimizing application logic complexity

if you have separate tables for separate transaction types, your queries are more complex to get all subtype data, but this design may be better suited to processing certain types separately

if it were me, i would just declare the extra columns in Account_Txns and not have separate tables

with one table, some columns may be null, and this makes some people uneasy, but not me

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 04-27-04, 15:32
john11 john11 is offline
Registered User
 
Join Date: Jan 2003
Posts: 6
will search as you stated

Thanks Rudy. I am a 1 man shop and it is tuff with noone to bounce ideas off. I will search for the terms you stated.
Thanks again,
John
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On