How to subtract fields and insert the value in other field automatically?
If this requirement is very important to you, take a look here - calculated fields in MariaDB - never any need to perform calculations - it's all taken care of for you! Although, as has been pointed out, you can always perform the calculations on the fly.