Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Postgres Trigger
drop table if exists table1; drop table if exists table2; create table table1( id integer NOT NULL,name character varying); create table table2(id integer NOT NULL,name character varying); create or replace function function_copy() returns trigger language plpgsql as $$ begin insert into table2(id,name) values(new.id,new.name); return new; end $$; create trigger trig_copy before insert or update on table1 for each row execute procedure function_copy(); insert into table1 (id, name) values (1, 'John'); insert into table1 (id, name) values (2, 'John2'); select * from table1; select * from table2; delete from table1 where id=1; select * from table1; select * from table2;
run
|
edit
|
history
|
help
0
JsonB Query
PC02-DB-UTEC
Studco
tegs and users
ds
Movie Rating SQL Analysis Conducted by Miranda Zhao
SQL primes, sqrt sieve
E-commerce Website SQL Analysis
SQL - Social Network Analysis by Patrick Lin
Update as a function result