O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Generated columns

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required