I'm struggling with creating a totalCost
column that is the sum of costA
and costB
for each row.
CREATE TABLE Cost (
customerId INTEGER NOT NULL,
costA FLOAT(4) NOT NULL,
costB FLOAT(4) NOT NULL,
totalCost FLOAT(4) GENERATED ALWAYS AS (costA + costB) STORED,
PRIMARY KEY (customerId)
);
Can anyone tell me what I'm missing? I would have thought this would be super simple!
Note - trying to build it in the DDL rather than a query.
Thank you! :)