LoslegenKostenlos loslegen

Unifying strings

Sometimes it's common to find messy strings when having different values for the same thing. Although all of these values can be valid, it is better to unify them to perform better analysis.

You run this query to filter all the airports located in the city of 'Chicago':

SELECT * FROM airports 
WHERE airport_code IN ('ORD', 'MDW')

In the results, you see that there are inconsistent values for 'Chicago' in the airport_city column, with values such as 'ch'. You will treat these inconsistent values by replacing them.

Diese Übung ist Teil des Kurses

Cleaning Data in SQL Server Databases

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

SELECT 
	airport_code,
	airport_name,
    -- Use the appropriate function to unify the values
    ___(airport_city, '___', '___') AS airport_city,
	airport_state
FROM airports  
WHERE airport_code IN ('ORD', 'MDW')
Code bearbeiten und ausführen