ID EN
String Comparison Functions

expr NOT LIKE pat [ESCAPE 'escape_char']

MySQL 8.4

expr NOT LIKE pat [ESCAPE 'escape_char']

Syntax

MYSQL
CREATE TABLE foo (bar VARCHAR(10));

INSERT INTO foo VALUES (NULL), (NULL);

Examples

Example

This is the same as NOT (expr LIKE pat [ESCAPE 'escape_char']).

MYSQL
CREATE TABLE foo (bar VARCHAR(10));

INSERT INTO foo VALUES (NULL), (NULL);
Example 2

Aggregate queries involving NOT LIKE comparisons with columns containing NULL may yield unexpected results. For example, consider the following table and data:

MYSQL
SELECT COUNT(*) FROM foo WHERE bar NOT LIKE '%baz%' OR bar IS NULL;