-- biometry_execution.Session_ID deve existir em biometry
SELECT COUNT(*) AS exec_sem_pai
FROM `ifood-prev-fraude-case.fraude_biometria.biometry_execution` e
    LEFT JOIN `ifood-prev-fraude-case.fraude_biometria.biometry` b ON e.Session_ID = b.Session_ID
WHERE b.Session_ID IS NULL;

-- biometry.Driver_ID deve existir em drivers
SELECT COUNT(*) AS biom_sem_driver
FROM `ifood-prev-fraude-case.fraude_biometria.biometry` b
    LEFT JOIN `ifood-prev-fraude-case.fraude_biometria.drivers` d ON b.Driver_ID = d.Driver_ID
WHERE d.Driver_ID IS NULL;

-- orders.Driver_ID deve existir em drivers
SELECT COUNT(*) AS order_sem_driver
FROM `ifood-prev-fraude-case.fraude_biometria.orders` o
    LEFT JOIN `ifood-prev-fraude-case.fraude_biometria.drivers` d ON o.Driver_ID = d.Driver_ID
WHERE d.Driver_ID IS NULL;
-- identificação de erro: orders.Driver_ID com tipos distintos (string e integer)
-- investigação do erro em checks/verificacao_driver_id.sql