Computed Column - Oracle to MariaDB Migration

In Oracle and MariaDB, you can define a computed (virtual) column that derives its values automatically by computing the specified expression.

Note that MariaDB requires the data type of a computed column to be explicitly specified while it is optional in Oracle.

Oracle:

   -- Short form (data type is optional)
   CREATE TABLE t1
   (
      c1 NUMBER(5),
      c2 AS (c1 + 1)
    );
    /* Table created. */
 
   -- Full form including the data type and all optional keywords
   CREATE TABLE t2
   (
      c1 NUMBER(5),
      c2 NUMBER(5) GENERATED ALWAYS AS (c1 + 1) VIRTUAL
    ); 
    /* Table created. */

MariaDB:

   -- Short form (data type must be specified)
   CREATE TABLE t1
   (
      c1 INT,
      c2 INT AS (c1 + 1)
    );
    /* Query OK, 0 rows affected */
 
   -- Full form including the data type and all optional keywords
   CREATE TABLE t2
   (
      c1 INT,
      c2 INT GENERATED ALWAYS AS (c1 + 1) VIRTUAL
    ); 
    /* Query OK, 0 rows affected */

For more information, see Oracle to MariaDB Migration.