Cleaning up results
Returning to the breakdown of Scandinavian awards you previously made, you want to clean up the results by replacing the nulls with meaningful text.
Questo esercizio fa parte del corso
PostgreSQL Summary Stats and Window Functions
Istruzioni dell'esercizio
- Turn the
nulls in theCountrycolumn toAll countries, and thenulls in theGendercolumn toAll genders.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
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;