Created
July 29, 2013 10:48
-
-
Save AlexArchive/6103538 to your computer and use it in GitHub Desktop.
Working with the LIKE predicate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- The % (Percent) Wildcard | |
SELECT empid, lastname | |
FROM HR.Employees | |
WHERE lastname LIKE N'D%'; | |
-- The _ (Underscores) Wildcard | |
SELECT empid, firstname, lastname | |
FROM HR.Employees | |
WHERE firstname LIKE N'___a'; | |
-- The [<List of Characters>] Wildcard | |
SELECT empid, lastname | |
FROM HR.Employees | |
WHERE lastname LIKE N'[ABC]%'; | |
-- The [<Character>-<Character>] Wildcard | |
SELECT empid, lastname | |
FROM HR.Employees | |
Where lastname LIKE N'[A-C]%'; | |
-- The [^<Character List or Range>] Wildcard | |
SELECT empid, lastname | |
FROM HR.Employees | |
WHERE lastname LIKE N'[^A-C]%'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment