https://www.postgresql.org/docs/9.6/plpgsql-declarations.html drop table account; --create table CREATE TABLE account( id SERIAL PRIMARY KEY, name VARCHAR NOT null, age numeric, amount numeric ); -- insert data into table INSERT INTO account (name,age,amount) values ('bonh',27,0); INSERT INTO account (name,age,amount) values ('kynp',27,0); --- select * from account SELECT * FROM account; -- delete record by id delete from account where id >= 3; SELECT * FROM account; -- procedure for tranfering drop procedure if exists transfer; CREATE OR REPLACE PROCEDURE transfer(INT, INT, DEC) LANGUAGE plpgsql AS $$ BEGIN -- subtracting the amount from the sender's account UPDATE account SET amount = amount - $3 WHERE id = $1; -- adding the amount to the receiver's account UPDATE account SET amount = amount ...