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'
1The LIKE operator is a logical operator that tests whether a string contains a specified pattern or not. Here is the syntax of the LIKE operator:
2
3expression LIKE pattern ESCAPE escape_character
4
5This example uses the LIKE operator to find employees whose first names start with a:
6
7SELECT
8 employeeNumber,
9 lastName,
10 firstName
11FROM
12 employees
13WHERE
14 firstName LIKE 'a%';
15
16 This example uses the LIKE operator to find employees whose last names end with on e.g., Patterson, Thompson:
17
18SELECT
19 employeeNumber,
20 lastName,
21 firstName
22FROM
23 employees
24WHERE
25 lastName LIKE '%on';
26
27
28 For example, to find all employees whose last names contain on , you use the following query with the pattern %on%
29
30SELECT
31 employeeNumber,
32 lastName,
33 firstName
34FROM
35 employees
36WHERE
37 lastname LIKE '%on%';