The Theory
Generated Columns is a feature released on MySQL 5.7. They can be used during
CREATE TABLE or ALTER TABLE statements.
It is a way of storing data without actually sending it through
the INSERT or UPDATE clauses in SQL.
The database resolves what the data will be.
There are two types of Generated Columns: Virtual and Stored. They work with:
- mathematical expressions (
product_price*quantity) - built-in functions (
RIGHT(),CONCAT(),FROM_UNIXTIME(),JSON_EXTRACT()) - literals (“2”, “new”, 0)
Besides that, they can be indexed but they don’t allow …
[Read more]