What are the advantages and disadvantages of recharging and spending on the same table or separately?

to make a recharge diamond system, I have no experience. I would like to ask the gods to make recharge records and expense records in one table, or separately from two tables? What are the advantages and disadvantages of each?

Mar.10,2021

as long as they are together, it is easy to check the running water. Otherwise, how to deal with the problem of time sequence if you separate the two tables?

id, user ID, quantity of this change (recharge is positive, consumption is negative), current balance, time, other parameters of IP,


separate composite database design patterns
to be combined, you can only merge with the user table, resulting in too many fields in a table


it makes sense to separate: reduce redundant fields. Generally speaking, the expense table will be associated with relevant fields to facilitate the view of the expense record, especially if you want to jump to the corresponding page according to the cost.

if you have to say that one advantage is that it is more convenient for users to know how to recharge and spend paging queries according to time

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e57e68-45466.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e57e68-45466.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?