Exercise

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

Instructions 1/3

undefined XP
    1
    2
    3
  • Select only the voters whose first name has fewer than 5 characters and email address meets these conditions in the same time: (1) starts with the letter “j”, (2) the third letter is “a” and (3) is created at yahoo.com.