Here is my sql:
create table student(
id smallint primary key auto_increment,
class_id smallint not null ,
name varchar(10) not null ,
birthday date not null ,
sex bool not null ,
age int as (to_days(now()-birthday))
);
output:
[2022-04-10 12:08:42] [HY000][3763] Expression of generated column 'age' contains a disallowed function: now.
[2022-04-10 12:08:42] [HY000][3763] Expression of generated column 'age' contains a disallowed function: now.
I searched for information and learned that functions with indeterminate return values like now()
cannot be used in calculated column expressions. How should I implement the calculation of the birthday column?