DELETE FROM tab_dependente
WHERE
cod_funcionario IN (
SELECT
cod_funcionario
FROM
tab_rh_demitidos
);
DELETE FROM tab_funcionario
WHERE
cod_funcionario IN (
SELECT
cod_funcionario
FROM
tab_rh_demitidos
);