Examples of the like operator
Use these examples to help you use the like operator in search criteria.
Example 1
The following example query identifies
the records in the employees
table that contain the lowercase
letter r
in the Name
column.
|phoenix:1.> select Name from staff.employees
|phoenix:2.> where Name like ".*[r].*";
|phoenix:3.> go
..
{
Name='Carl';
}
{
Name='Sarah';
}
( 2 record(s) : Transaction complete )
Example 2
The following example query identifies
the records in the employees
table for which the Name
column
begins with an uppercase C
or upper R
.
|phoenix:1.> select Name from staff.employees
|phoenix:2.> where Name like "^[CR]";
|phoenix:3.> go
..
{
Name='Carl';
}
{
Name='Rob';
}
( 2 record(s) : Transaction complete )
Example 3
The following example query would
return the complete records of all employees listed in the contractors
table
whose name begins with an uppercase letter J
.
|phoenix:1.> select EmployeeID, Name from staff.contractors
|phoenix:2.> where Name like "J";
|phoenix:3.> go
..
{
EmployeeID=11;
Name='James';
}
{
EmployeeID=13;
Name='Jane';
}
( 2 record(s) : Transaction complete )