I need to be able to store transaction data, such as a deposit or a withdrawal. Both have 3 feilds, date, desciption, and amount.
Should I create two tables, a deposit table and a withdrawal table
Or have one table called transactions, that stores both, so it will have a fourth field called type(deposit or withdrawal)
What do I have to consider with going for one or the other?
How should I design my database?
Moderator: General Moderators
Re: How should I design my database?
I would have a single transaction table. Withdrawal records would have a negative amount, deposit - positive. This way it's easy to summarize actions taken on behalf of particular account, using sum() + group by.
Re: How should I design my database?
k thanks.
Also this will allow me more flexibility such as if i wanted to add a type called bill
Also this will allow me more flexibility such as if i wanted to add a type called bill