transaction table help

B

Bruce

I am designing a database for trades. The following is what I have so far….
Trans_ID is the primary key and is just an incremental field.

Tbl_Transactions
Trans_ID autonumber PK
Security text
Price Number
Qty Number
Trans_Type Text
Trade_ID Number FK

What’s my problem?
The values in the Trans_Type field can be either ‘buy’ or ‘sell’. So in
other words a security will be bought at one time and sold at another. I want
to tie these 2 records together with the Trade_ID field. In other words I
what it to basically be a number that will be represented twice.

Eg

Record 1

Trans_ID 1
Security NAB
Price 2.00
Qty 100
Trans_Type Buy
Trade_ID 1

Record 2

Trans_ID 2
Security NAB
Price 2.10
Qty 100
Trans_Type Sell
Trade_ID 1

What additional tables / fields do I need to do this? What should be the PK
and data types etc?

I may have to consider dates down the track as it would be possible to
repeat a trade as long as there is no overlap of dates.

Bruce
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top