Skip to content

MATCHES

SELECT *
FROM Student
WHERE Name REGEXP '^J';
| ID | Name | Grade |
|----|-------|-------|
| 1 | John | B |
| 3 | James | A |

The example SQL command is a SELECT statement that returns all the records of students whose names begin with the letter ‘J’ in the ‘Student’ table. The REGEXP operator is used for complex searches using regular expressions, in this case ‘^J’ which means any string that starts with ‘J’.