Skip to content

LIKE_REGEX

SELECT name FROM employees WHERE name REGEXP '[A-Z]$';
+------+
| name |
+------+
| John |
| Paul |
+------+

In the given SQL statement, we are using the REGEXP keyword as a comparator to filter the rows from the ‘employees’ table based on the provided regular expression ‘[A-Z]$’. This regular expression matches any string that ends with an uppercase letter. As a result, the names ‘John’ and ‘Paul’, which end with an uppercase letter, are returned.