Computed/Generated columns in MySQL 5 How do I create a table with a formula column in MySQL version 5?

For example: I have a table named Product, which has 5 columns:

id int,
amount int,
sold_out int,
faulty int,
remain_amount is (amount-(sold_out+faulty))


I will not use a trigger or a view.

I am looking for a solution similar to what, in SQL Server, is called a computed column.
Wait for 5.7 where generated fields are supported

mysql&gt; CREATE TABLE sales ( 
    -&gt; name VARCHAR(20),  
    -&gt; price_eur DOUBLE,
    -&gt; amount INT,
    -&gt; total_eur DOUBLE AS (price_eur * amount),
    -&gt; total_usd DOUBLE AS (total_eur * xrate),
    -&gt; xrate DOUBLE);
Query OK, 0 rows affected (0,16 sec)


http://mysqlserverteam.com/generated-columns-in-mysql-5-7-5/

Or use MariaDB, where virtual/computed columns are working now. These are a beta feature in MySQL 5.7.