Is it better to use one table or two for transaction records?

0
4
Asked By CraftyNinja42 On

I've been working on a small trade system where A can buy from or sell to B. I've set up two separate tables: one for Sales and one for Purchases. Each table contains similar columns referencing the users A and B, the item, and the amount. I considered combining these into a single table with a 'Type' column to distinguish between sales and purchases but opted for the two-table approach, thinking it better conveys the meaning of the transaction direction without needing that extra column. What are your thoughts on this design choice?

1 Answer

Answered By DatabaseDynamo67 On

Honestly, I’d stick to one table and just add a 'transaction type' column. This way, you eliminate duplication and can easily manage queries about total transactions or net amounts without jumping between tables. Plus, clearer column names for sender and receiver can help later on!

CodeCraftsman88 -

I’m not sure about changing column names for sender and receiver. I think it's cleaner to keep separate entities in their own tables, especially if you need additional contact info later.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.