ComeçarComece gratuitamente

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

Ver Curso

Instruções de exercício

  • Transforme o nulls na coluna Country em All countries, e o nulls na coluna Gender em All 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;
Editar e executar código