Home  >  Article  >  Database  >  In MySQL, how to check for a non-existent pattern in an expression?

In MySQL, how to check for a non-existent pattern in an expression?

PHPz
PHPzforward
2023-09-10 10:57:021090browse

在 MySQL 中,如何检查表达式中不存在的模式?

MySQL NOT RLIKE operator can be used to check for a pattern that does not exist in an expression. The syntax of NOT RLIKE is as follows -

grammar

NOT RLIKE Pat_not_for_match

Here Pat_not_for_match is a pattern that does not match the expression.

Example

mysql> Select Id, Name from Student WHERE Name NOT RLIKE '^H';
+------+---------+
| Id   | Name    |
+------+---------+
| 1    | Gaurav  |
| 2    | Aarav   |
| 20   | Gaurav  |
| 21   | Yashraj |
+------+---------+
4 rows in set (0.00 sec)

The above query finds names from the "student" table that do not have a pattern starting with "H". ^ is a wildcard used with NOT RLIKE to indicate the beginning of a string.

The above is the detailed content of In MySQL, how to check for a non-existent pattern in an expression?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete