Home > Database > Mysql Tutorial > What is the use of MySQL NOT LIKE operator?

What is the use of MySQL NOT LIKE operator?

王林
Release: 2023-09-15 19:21:03
forward
1053 people have browsed it

MySQL NOT LIKE 运算符有什么用?

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.

Example

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

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!

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