A generated column can either be virtual or stored. You can store a mix of virtual and stored columns in a table. Generated columns can refer to other generated columns, as long as the generated column you are referring to is earlier in the table definition.
- Virtual: Column values aren't stored on disk and therefore don't use any storage. They are evaluated when the rows are read with a query. They only support secondary indexes, so you can't place this column in a primary key. This is explained next, with the GENERATED ALWAYS AS syntax.
- Stored: Column values are stored on insert and update, and therefore take storage on disk. Stored generated columns can have indexes placed on them. This is explained next, ...