[Answer]-What is the best database structure for this situation?

1👍

You should probably separate sale and purchase into two separate tables (and sale_item and purchase_item.) Even though they have duplicate columns — for now — they represent separate concepts.

In the future, it’s easy to imagine that either of those concepts could change in some way so that the underlying tables would not have all the same columns.

Having two separate sets of tables also makes it easier to query.

0👍

Normalizing the tables according to your entities is the right approach.

Additionally, I would think about the probability that you’d want those entities presented together, merged, in the same list view.

Looking at the entities you are referring to, I think sale_item and purchase_item have high probability to be used interchangeably, so I would put then in the same table.

Leave a comment