Postgresql Create Trigger Before Deleting A Row
问题 so i have these two tables: Table user columns: id,name,surname, password,token,earnedmoney Table addlisting columns: id, user_fk,price,date_added Here is my problem: I would like to create a trigger so that when I delete a listing from the table addlisting, the price of the listing gets added to the column "earnedmoney" which is in the table user. Could somebody help me? Thank you! 回答1: CREATE OR REPLACE FUNCTION add_money() RETURNS trigger AS $$BEGIN UPDATE "user" SET earnedmoney =