RLIKE

RLIKE is an SQL operator used in WHERE clause to search for a specified pattern in a column. It is a synonym for REGEXP, providing advanced pattern matching capabilities by supporting regular expressions.

expr RLIKE pat

Example

SELECT * FROM Employees
WHERE Name RLIKE '^[A-C]';

Output

| ID | Name | Age |
|----|--------|-----|
| 1 | Alice | 25 |
| 2 | Bob | 30 |
| 4 | Carlos | 28 |

Explanation

In the SQL statement provided, the RLIKE operator is used in a WHERE clause to filter rows containing names that start with any letter between A and C. The regular expression ’^[A-C]’ denotes matching any string that starts(^) with any of the letters A, B, or C. The output of the query contains only the rows where the Name column satisfies this condition.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.