CommencerCommencer gratuitement

Using the beginning or end of a string

Sometimes you may need to take only certain parts of a string. If you know that those parts can be found at the beginning or the end of the string, remember that there are built-in functions that can help you with this task.

You will use these functions in this exercise. The purpose is to create an alias for each voter from the voters table, as a combination of the first 3 letters from the first name, the last 3 letters from the last name, and the last 2 digits from the birthday.

Cet exercice fait partie du cours

Functions for Manipulating Data in SQL Server

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

SELECT 
	first_name,
	last_name,
	country,
    -- Select only the first 3 characters from the first name
	___ AS part1
FROM voters;
Modifier et exécuter le code