SELECT columns using the LIKE keyword

Using the WHERE clause to return on the records in the Employee table where the employees are a manager of some type. This example uses the % character for any number of characters.

SELECT LoginID, JobTitle
FROM [HumanResources].[Employee]
WHERE JobTitle like '%MANAGER%'

Using the LIKE keyword to return records from the Person table where users’ first names end in “ary”. This example uses the _ characters to represent a single character.

SELECT *
FROM Person.Person
WHERE FirstName LIKE '_ary'

Using the LIKE keyword to return records from the Person table where users’ first names end in “ary”. This example uses the [] characters to represent a single character found within the list of characters in the [].

SELECT *
FROM Person.Person
WHERE FirstName LIKE '[g-m]ary'

Using the LIKE keyword to return records from the Person Tables where users’ names end in “ary”. This example uses the [^] characters to represent a single character to exclude characters in the name searched.

SELECT FirstName, LastName
FROM Person.Person
WHERE FirstName LIKE '[^g]ary'

Using the NOT LIKE keywords to return records from the Person table where users’ first names do NOT end in “ary”.

SELECT FirstName, LastName
FROM Person.Person
WHERE FirstName NOT LIKE '_ary'