UPDATESQL

Unit 3, lesson 1 · UPPER, TRIM

Tidy text with UPPER and TRIM

Tidy the city names

Text typed by people is rarely consistent. TRIM removes spaces at the start and end of a value, so TRIM(' Denver ') is 'Denver'. UPPER turns every letter into a capital, the opposite of LOWER from unit 2. You can wrap one function inside another: the inner one runs first.

Example
SELECT name,
       UPPER(category) AS category_code
FROM products;

Your task

People typed their city into the newsletter sign-up form however they liked: extra spaces, any capitals. List each sign-up's id and its city cleaned up, with the spaces at either end removed and every letter in capitals, as clean_city.

Tables you will use: signups

Try it in your browserFree, no sign-up. Your query is checked as you go.