Limpeza dos resultados
Voltando ao detalhamento dos prêmios escandinavos que você fez anteriormente, você deseja limpar os resultados substituindo os null
s por um texto significativo.
Este exercício faz parte do curso
PostgreSQL Estatísticas de resumo e funções de janela
Instruções de exercício
- Transforme o
null
s na colunaCountry
emAll countries
, e onull
s na colunaGender
emAll genders
.
Exercício interativo prático
Experimente este exercício preenchendo 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;