I want to create a MySQL table that has four column For example, id,piece,price,totalprice
When data inserted into id,piece,price column totalprice must be initialized from (piece * price)
Insert data
id piece price
101 2 10
Result
id piece price totalprice
101 2 10 20
I can create a table with four column but i can't automatically initialized into totalprice column using the piece and price column value.
How to do that?