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 > Table setup decision

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-06-10, 09:27
CVD CVD is offline
Registered User
 
Join Date: Apr 2008
Posts: 27
Table setup decision

I'm setting up a checking/saving/budget database for myself to replace one I set up for myself some years ago.

I've run into a dilemma while setting up the tables.

Transactions have attributes like date, payee, amount, and type (debit or deposit). Of course, debit-type transactions have one payee and one amount. But for deposit-type transactions, I'd like to be able to record where the money came from when multiple sources and amounts make up the deposit. For instance, say I go to the bank to make a $100 deposit. Maybe $50 of the $100 was cash from returning something to a store, $20 was a rebate check for a DVD player, and $20 was a check from my employer reimbursing me for something, and the last $10 was misc cash from a drawer in my house.

So that's a $100 transaction that has 3 payees (or sources, but since I want to pull suggestions from past transactions, they're really the same thing) with 3 amounts I want to record, and the remaining $10 that has no specified payee/source.

What's the best way to set these tables up?

Thanks.

Part 2: What is the term for what I'm asking about? Is it "db schema"? just "db design"? "db structure"? none of these? all of these?

Last edited by CVD; 02-06-10 at 11:13.
Reply With Quote
  #2 (permalink)  
Old 02-06-10, 09:58
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,516
Quote:
Originally Posted by CVD View Post
0 vote down star
3 spit sideways horseradish


Quote:
Originally Posted by CVD View Post
What's the best way to set these tables up?
with a comment/note text column, so that you can enter a comment on the transaction, outlining the sources or anything else that you wanted to make a note of about the transaction

Quote:
Originally Posted by CVD View Post
Part 2: What is the term for what I'm asking about? Is it "db schema"? just "db design"? "db structure"? none of these? all of these?
database design is probably the closest
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 02-06-10, 11:15
CVD CVD is offline
Registered User
 
Join Date: Apr 2008
Posts: 27
Quote:
Originally Posted by r937 View Post
3 spit sideways horseradish
lol. Fixed.

Quote:
Originally Posted by r937 View Post
with a comment/note text column, so that you can enter a comment on the transaction, outlining the sources or anything else that you wanted to make a note of about the transaction
But that wouldn't be very query-friendly.
Reply With Quote
  #4 (permalink)  
Old 02-06-10, 11:22
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,516
Quote:
Originally Posted by CVD View Post
But that wouldn't be very query-friendly.
please describe the sorts of queries you will want to run against this information

it sounds like you already have decided which way to design this...
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
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