Skip to content

Instantly share code, notes, and snippets.

@thomascj1
thomascj1 / questao_2.sql
Created April 3, 2025 19:27
Lia Junior Data Analyst Case Q2
SELECT
d.nome AS departamento,
COUNT(e.id) AS quantidade_empregados,
ROUND(COALESCE(AVG(e.salario), 0), 2) AS media_salarial,
MAX(e.salario) AS maior_salario,
MIN(e.salario) AS menor_salario
FROM departamentos d
LEFT JOIN empregados e ON d.id = e.departamento_id
GROUP BY d.nome
ORDER BY media_salarial DESC;
@thomascj1
thomascj1 / questao_1.sql
Created April 3, 2025 19:18
Lia Junior Data Analyst Case
##Questão 1a
SELECT
sch.name AS school,
st.enrolled_at AS day,
COUNT(st.id) AS enrolled_students,
SUM(c.price) AS total_enrollment_value
FROM students st
JOIN courses c ON st.course_id = c.id
JOIN schools sch ON c.school_id = sch.id