Derived Column Values?

Advertisement

The SQL standard allows the generation of values dependent on other columns. Even though on-the-fly calculations are usually more efficient, it can sometimes be handy to do so. The syntax is as follows:

CREATE TABLE Articles
(
...
stock_items INTEGER NOT NULL,
list_price DECIMAL(7,2) NOT NULL,
stock_value GENERATED ALWAYS AS (stock_items * list_price),
...
)

Does any such a thing exist in MySQL? Am I stuck to manually put such logic into my INSERT statements?