Skip to content

Instantly share code, notes, and snippets.

@pedrosteinmuller
Last active March 31, 2025 22:12
Show Gist options
  • Select an option

  • Save pedrosteinmuller/ef3f5df8c8f4c3a793541ba8e127956b to your computer and use it in GitHub Desktop.

Select an option

Save pedrosteinmuller/ef3f5df8c8f4c3a793541ba8e127956b to your computer and use it in GitHub Desktop.
Lia - Junior Data Analyst - Teste técnico - SQL - Questão 2 - Candidato Pedro Steinmuller Pimentel
SELECT
dp.nome as nome_departamento,
COUNT(emp.matr) as quantidade_empregados,
ROUND(COALESCE(AVG(venc.valor), 0), 2) as media_salario,
ROUND(COALESCE(MAX(venc.valor), 0), 2) as maior_salario,
ROUND(COALESCE(MIN(venc.valor), 0), 2) as menor_salario
FROM public.departamento AS dp
JOIN empregado AS emp ON dp.cod_dep = emp.gerencia_cod_dep
JOIN emp_venc AS empv ON emp.matr = empv.matr
JOIN vencimento as venc ON empv.cod_venc = venc.cod_venc
GROUP BY dp.nome
ORDER BY media_salario DESC;
@pedrosteinmuller
Copy link
Author

questao2_teste_tecnico_lia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment