我创建了一个包含以下列的 mysql 表...
item_price, discount, delivery_charge, grand_total
item_price
、discount
和all的值delivery_charge
取决于所考虑的项目,这些将手动填写到表中。
我想让 mysql使用下面的公式根据、和grand_total
的值填充列中的值...item_price
discount
delivery_charge
grand_total = item_price - discount + delivery_charge
在mysql中创建表结构时,我可以以某种方式为该列指定一个公式吗?我知道这可以使用 php 完成,但如果可能的话,我更喜欢数据库自动为我执行此操作。