By using MySQL's NOT LIKE operator, we can check that a string with a specified pattern does not exist in another string. Its syntax is NOT LIKE specific_pattern.
specific_pattern is a string pattern that we don't want to find in another string.
Suppose we have a table called 'student_info' which contains the names of students and we want to get those that do not contain the string pattern 'Ga' in their names Student details. This can be achieved with the following MySQL query -
mysql> Select * from Student_info WHERE name NOT LIKE '%Ga%'; +------+---------+----------+-----------+ | id | Name | Address | Subject | +------+---------+----------+-----------+ | 101 | YashPal | Amritsar | History | | 125 | Raman | Shimla | Computers | +------+---------+----------+-----------+ 2 rows in set (0.05 sec)
In the above example, the ‘%’ symbol is the wildcard character used with the NOT LIKE operator.
The above is the detailed content of What is the use of MySQL NOT LIKE operator?. For more information, please follow other related articles on the PHP Chinese website!