generated column in mySQL workbench
The short answer is you can't. The rules for the expression of the generated column are (see create-table-generated-columns.html):

Generated column expressions must adhere to the following rules. An
error occurs if an expression contains disallowed constructs.

Literals, deterministic built-in functions, and operators are
permitted. A function is deterministic if, given the same data in
tables, multiple invocations produce the same result, independently of
the connected user. Examples of functions that are nondeterministic
and fail this definition: CONNECTION_ID(), CURRENT_USER(), NOW().

Stored functions and user-defined functions are not permitted.

Stored procedure and function parameters are not permitted.

Variables (system variables, user-defined variables, and stored
program local variables) are not permitted.

Subqueries are not permitted.

A generated column definition can refer to other generated columns,
but only those occurring earlier in the table definition. A generated
column definition can refer to any base (nongenerated) column in the
table whether its definition occurs earlier or later.


[...]