| id | price | quantity | total |
| 1 | 5 | 5 | 25 |
I want to create a total = price * quantity column. What I have to do??
| id | price | quantity | total |
| 1 | 5 | 5 | 25 |
I want to create a total = price * quantity column. What I have to do??
You could use generated column:
ALTER TABLE tab
ADD COLUMN total INT GENERATED ALWAYS AS (price*quantity) STORED;
-- INT or any appropriate data type