MulaiMulai sekarang secara gratis

Looking for a pattern within a string

If you want to search for a pattern in a string, PATINDEX() is the function you are looking for. This function returns the starting position of the first occurrence of the pattern within the string.

The syntax is: PATINDEX('%pattern%', expression)

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

In this exercise, you are going to use the voters table to look at information about the voters whose names follow a specified pattern.

Latihan ini adalah bagian dari kursus

Functions for Manipulating Data in SQL Server

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

SELECT 
	first_name,
	last_name,
	email 
FROM voters
-- Look for first names that contain "rr" in the middle
WHERE ___;
Edit dan Jalankan Kode