LoslegenKostenlos loslegen

Using RIGHT() , LEFT() and REVERSE()

In the previous exercise, you used SUBSTRING() and CHARINDEX() to split the city_state column into two new columns.

This time you need to do the same, but using the LEFT(), RIGHT(), and REVERSE() functions.

Diese Übung ist Teil des Kurses

Cleaning Data in SQL Server Databases

Kurs anzeigen

Anleitung zur Übung

  • Extract the name of the city using LEFT() and CHARINDEX().
  • Extract the name of the state using RIGHT(), CHARINDEX() and REVERSE().

Interaktive Übung

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

SELECT
	client_name,
	client_surname,
    -- Extract the name of the city
	___(city_state, ___(', ', city_state) - 1) AS city,
    -- Extract the name of the state
    ___(city_state, ___(' ,', ___(city_state)) - 1) AS state
FROM clients_split
Code bearbeiten und ausführen