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 t
2 Department-2 Type B f
3 Department-3 Type A t
SELECT 3
INSERT 0 1
employee_id employee_name department_id flagtypea
1 Employee-1 1 t
SELECT 1
ERROR:  insert or update on table "employees" violates foreign key constraint "fk_department_typea"
DETAIL:  Key (department_id, flagtypea)=(2, t) is not present in table "departments".
INSERT 0 1
employee_id employee_name department_id flagtypea
1 Employee-1 1 t
3 Employee-3 3 t
SELECT 2