郎朗坤
mysql> create table test -> (id int, -> col int generated always as (id+1) stored comment "generated column" -> );Query OK, 0 rows affected (0.04 sec)
mysql> show create table test\G*************************** 1. row *************************** Table: testCreate Table: CREATE TABLE `test` ( `id` int(11) DEFAULT NULL, `col` int(11) GENERATED ALWAYS AS ((`id` + 1)) STORED COMMENT 'generated column'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
1 row in set (0.00 sec)