Clean up the country report
An SQL exercise from Querydrill. Solve it with a SQL editor in your browser, checked on the rows it returns and again on changed data, and it is checked the moment you submit.
The task
From Marta in Marketing: "Our country report shows US, us and ' Us' as three different countries. Send me each country once, in capitals with no spaces around it, with the number of signups. Leave out signups that have no country." Return two columns: country and signups.
What this exercise teaches
In real data the same value often arrives in several spellings. Clean it inside the GROUP BY, or every spelling becomes its own group.
A hint if you get stuck
TRIM removes the spaces and UPPER fixes the capitals. Group by the cleaned value, not the raw column, and filter out NULL and empty strings.
Try it now, no account needed
This exercise is free. Open it on the practice page, solve it, and get instant feedback with a hint and a worked solution after two tries.
Open this exercise