The SQL LIKE clause is used to compare a value to similar values using wildcard operators. There are two wildcards used in conjunction with the LIKE operator: The percent sign (%) The underscore (_) The percent sign represents zero, one, or multiple characters. The underscore represents a single number or character. The symbols can be used in combinations.
SELECT * FROM Customer
WHERE CustomerName LIKE 'a%'
GO
SELECT * FROM Customer
WHERE CustomerName LIKE '%a%'
Go
SELECT * FROM Customer
WHERE CustomerName LIKE 'a_'
Go
SELECT * FROM Customer
WHERE CustomerName LIKE '_a'
GO
SELECT * FROM Customer
WHERE CustomerName LIKE '_a_'
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
The SQL LIKE clause is used to compare a value to similar values using wildcard operators. There are two wildcards used in conjunction with the LIKE operator:
The percent sign (%)
The underscore (_)
The percent sign represents zero, one, or multiple characters. The underscore represents a single number or character. The symbols can be used in combinations.