Home > Database > Mysql Tutorial > body text

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

PHPz
Release: 2023-09-10 10:57:02
forward
1089 people have browsed it

在 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
Copy after login

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)
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template