1WHERE CustomerName LIKE 'a%'
2--Finds any values that start with "a"
3WHERE CustomerName LIKE '%a'
4--Finds any values that end with "a"
5WHERE CustomerName LIKE '%or%'
6--Finds any values that have "or" in any position
7WHERE CustomerName LIKE '_r%'
8--Finds any values that have "r" in the second position
9WHERE CustomerName LIKE 'a__%'
10--Finds any values that start with "a" and are at least 3 characters in length
11WHERE ContactName LIKE 'a%o'
12--Finds any values that start with "a" and ends with "o"
1SELECT * FROM table_name WHERE UPPER(col_name) LIKE '%SEARCHED%';
2SELECT * FROM table_name WHERE col_name LIKE '%Searched%'; -- Case sensitive
3
4SYMBOL DESCRIPTION (SQL) EXAMPLE
5% zero or more characters bl% 'bl, black, blue, blob'
6_ a single character h_t 'hot, hat, hit'
7[] any single character within brackets h[oa]t 'hot, hat', but NOT 'hit'
8^ any character not in the brackets h[^oa]t 'hit', but NOT 'hot, hat'
9- a range of characters [a-b]t 'cat, cbt'
1-- example
2SELECT Id, ProductName, UnitPrice, Package
3 FROM Product
4 WHERE ProductName LIKE 'Cha_' OR ProductName LIKE 'Chan_'
1eturns true if the operand value matches a pattern.
2Example: Returns true if the user’s first_name ends with ‘son’.
3SELECT * FROM users
4WHERE first_name LIKE '%son';
5
1WHERE CustomerName LIKE 'a%'
2--Finds any values that start with "a"
3WHERE CustomerName LIKE '%a'
4--Finds any values that end with "a"
5WHERE CustomerName LIKE '%or%'
6--Finds any values that have "or" in any position
7WHERE CustomerName LIKE '_r%'
8--Finds any values that have "r" in the second position
9WHERE CustomerName LIKE 'a__%'
10--Finds any values that start with "a" and are at least 3 characters in length
11WHERE ContactName LIKE 'a%o'
12--Finds any values that start with "a" and ends with "o"
13
14(Like) Operator for partial searches using wildcard '%' and '_'
15For Example:
16Select * From Employees
17Where last_name LIKE '_a%';