add remove split language chart show hidden hide
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE
INSERT 0 3
CREATE TABLE
department_id department_name department_type flagtypea
1 Department-1 Type A 1
2 Department-2 Type B 0
3 Department-3 Type A 1
SELECT 3
INSERT 0 1
employee_id employee_name department_id flagtypea
1 Employee-1 1 1
SELECT 1
ERROR:  insert or update on table "employees" violates foreign key constraint "fk_department_typea"
DETAIL:  Key (department_id, flagtypea)=(2, 1) is not present in table "departments".
INSERT 0 1
employee_id employee_name department_id flagtypea
1 Employee-1 1 1
3 Employee-3 3 1
SELECT 2