НачатьНачать бесплатно

Applying various string functions on data

As you may have noticed, string functions are really useful for manipulating data. SQL Server offers a lot of built-in functions for string manipulation and some of them are quite fun to use. In this exercise, you are going to apply several string functions to the data from the voters table, to show it in a more presentable manner.

You will get the chance to use functions like: LEN(), UPPER(), PATINDEX(), CONCAT(), REPLACE() and SUBSTRING().

Remember: when searching for patterns within a string, these are the most helpful:

pattern match
% any string of zero or more characters
_ any single character
[] any single character within the range specified in brackets

Это упражнение является частью курса

Functions for Manipulating Data in SQL Server

Посмотреть курс

Интерактивное практическое упражнение

Попробуйте выполнить это упражнение, дополнив этот пример кода.

SELECT
	first_name,
    last_name,
	birthdate,
	email,
	country
FROM voters
   -- Select only voters with a first name less than 5 characters
WHERE ___(___) < 5
   -- Look for the desired pattern in the email address
	AND ___(___, ___) > 0;
Редактировать и запускать код