Limpeza dos resultados
Voltando ao detalhamento dos prêmios escandinavos que você fez anteriormente, você deseja limpar os resultados substituindo os nulls por um texto significativo.
Este exercício faz parte do curso
PostgreSQL Estatísticas de resumo e funções de janela
Instruções do exercício
- Transforme o
nulls na colunaCountryemAll countries, e onulls na colunaGenderemAll genders.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
SELECT
-- Replace the nulls in the columns with meaningful text
___(Country, ___) AS Country,
___(Gender, ___) AS Gender,
COUNT(*) AS Awards
FROM Summer_Medals
WHERE
Year = 2004
AND Medal = 'Gold'
AND Country IN ('DEN', 'NOR', 'SWE')
GROUP BY ROLLUP(Country, Gender)
ORDER BY Country ASC, Gender ASC;