The generated columns are also known as virtual or computed columns. The values of a generated column are computed from an expression included in the column definition. There are two types of generated columns:
- Virtual: The column will be calculated on the fly when a record is read from a table
- Stored: The column will be calculated when a new record is written in the table and will be stored in the table as a regular column
Virtual generated columns are more useful than stored generated columns because a virtual column does not take any storage space. You can simulate the behavior of stored generated columns using triggers.