I am trying to get the sum of amount from purchases and insert it into the table total_expenses. I don't really understand how to add the values of aggregate functions into other tables as new tuples. Could someone help me on this?
INSERT INTO total_expenses VALUES (Select sum(amount) from purchases);
This procedure gives me "ERROR: syntax error at or near "select""