- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
In MySQL, how to check for a pattern which is not present within an expression?
MySQL NOT RLIKE operator can be used to check for a pattern which is not present within an expression. The syntax for NOT RLIKE is as follows −
Syntax
NOT RLIKE Pat_not_for_match
Here Pat_not_for_match is the pattern which is not to be matched with 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 the names from the ‘student’ table which do not have the pattern starts with ‘H’. ^ is a wildcard used with NOT RLIKE and signifies the beginning of the string.
Advertisements