

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 can we check whether a string of a specified pattern is not present within another string?
We can check whether a string of specified pattern is not present within another string by using NOT LIKE operator along with wildcard characters.
Syntax
NOT LIKE specific_pattern
Specific_pattern is the pattern of string we do not want to find out within another string.
Example
Suppose we have a table named ‘student’ having names of the students and we want to get the details of all those students which are not having a pattern of string ‘av’ within their names. It can be done with the help of following MySQL query:
mysql> Select * from Student WHERE name NOT LIKE '%av%'; +------+---------+---------+----------+--------------------+ | Id | Name | Address | Subject | year_of_Admission | +------+---------+---------+----------+--------------------+ | 15 | Harshit | Delhi | Commerce | 2009 | | 21 | Yashraj | NULL | Math | 2000 | +------+---------+---------+----------+--------------------+ 2 rows in set (0.00 sec)
In the above example, the ‘%’ symbol is a wildcard used along with NOT LIKE operator.
- Related Questions & Answers
- How it is possible in MySQL to find a string of specified pattern within another string?
- In MySQL, how to check for a pattern which is not present within an expression?
- In MySQL, how can we pad a string with another string?
- How can we retrieve the length of a specified string in MySQL?
- How can we replace all the occurrences of a substring with another substring within a string in MySQL?
- How to check index within a string of a specified substring in JSP?
- Check whether the Average Character of the String is present or not in Python
- How to check in R whether a matrix element is present in another matrix or not?
- Java Program to check whether one String is a rotation of another.
- Program to check we can replace characters to make a string to another string or not in C++
- Check If a String Can Break Another String in C++
- Check whether a string is valid JSON or not in Python
- How to Check Whether a String is Palindrome or Not using Python?
- How to check whether a String contains a substring or not?
- How to check if a string is a subset of another string in R?
Advertisements