Returning all data from a table
Select some columns
Filtering rows
Logic
Text patterns
17. The percentage wildcard (%) continued
To be or NULL to be
A bit of mathematics
Let's practice

Instruction

Well done! Of course, the percentage wildcard (%) can be used anywhere between the single quotes and as many times as necessary:

SELECT
  *
FROM User
WHERE Name LIKE N'%A%';

The example above will select any user whose name contains at least one 'A'. (Recall that we'll be treating two strings with different capitalization as equivalent.)

Remember that the percentage wildcard (%) can also replace zero characters, so in theory, the name could begin and end with an 'A'.

Exercise

Select the Vin of all cars whose model ends with an 's'.

Stuck? Here's a hint!

Type:

SELECT
  Vin
FROM Car
WHERE Model LIKE N'%s';