In SQL, use the NOT LIKE operator to query strings that are not equal to a specific pattern. Syntax: SELECT * FROM table_name WHERE column_name NOT LIKE '%pattern%'; where %pattern% is the pattern to be matched, and % represents the wildcard character.
How to use LIKE query in SQL is not equal
In SQL, we can use the LIKE operator to Matches strings containing a specific pattern. If we want to query for strings that are not equal to a specific pattern, we can use the NOT LIKE operator.
Syntax:
<code>SELECT * FROM table_name WHERE column_name NOT LIKE '%pattern%';</code>
Among them:
is the name of the table to be queried.
is the column name to match the pattern.
is the pattern to match, where % represents a wildcard character, matching any number of characters.
customers table:
<code>SELECT * FROM customers WHERE name NOT LIKE '%John%';</code>
The above is the detailed content of How to write like in sql is not equal to. For more information, please follow other related articles on the PHP Chinese website!