I have two tables: The first one contains numeral values, it looks like this:
The id
column is the primary key; it has the attribute AUTO_INCREMENT
. All columns have the datatype INT
.
Now my question: Can I create a table like the following:
create table testsumtable
(
id int primary key auto_increment,
sumColumn int generated always as (sum(SELECT intone, inttwo, intthree FROM valuestable WHERE id=new.id))
);