clear markdown feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3364508 fiddles created (40489 in the last week).

CREATE TABLE tableA (id VARCHAR(255)); CREATE TABLE tableB (id VARCHAR(255)); CREATE TABLE tableC (id VARCHAR(255));
 hidden batch(es)


CREATE TABLE tableABC (id VARCHAR(255) UNIQUE); CREATE TRIGGER tr_bi_a BEFORE INSERT ON tableA FOR EACH ROW INSERT INTO tableABC VALUES (NEW.id); CREATE TRIGGER tr_bi_b BEFORE INSERT ON tableB FOR EACH ROW INSERT INTO tableABC VALUES (NEW.id); CREATE TRIGGER tr_bi_c BEFORE INSERT ON tableC FOR EACH ROW INSERT INTO tableABC VALUES (NEW.id);
 hidden batch(es)


INSERT INTO tableA VALUES ('keyA'); -- success INSERT INTO tableB VALUES ('keyB'); -- success INSERT INTO tableC VALUES ('keyC'); -- success INSERT INTO tableA VALUES ('keyAA'); -- success INSERT INTO tableB VALUES ('keyBB'); -- success
 hidden batch(es)


INSERT INTO tableC VALUES ('keyC'); -- already present in tableC
Duplicate entry 'keyC' for key 'tableABC.id'
 hidden batch(es)


INSERT INTO tableA VALUES ('keyC'); -- already present in tableC
Duplicate entry 'keyC' for key 'tableABC.id'
 hidden batch(es)


INSERT INTO tableB VALUES ('keyA'); -- already present in tableA
Duplicate entry 'keyA' for key 'tableABC.id'
 hidden batch(es)


INSERT INTO tableC VALUES ('keyABC'); -- success
 hidden batch(es)