Beginner

369. NOT LIKE

Learn how to exclude text values matching a specific pattern.

📘 Lesson 369 of 728 ⏱ 8 min 🎯 Beginner

NOT LIKE returns rows whose text values do not match the specified pattern.

NOT LIKE is useful when a report needs to exclude records containing a particular text pattern.

Find customer names that do not start with the letter A.

SQL
SELECT
    CustomerName
FROM Customers
WHERE CustomerName NOT LIKE 'A%';

It can be used for data cleansing, exclusion rules, customer analysis, and filtering unwanted text patterns.

  • NOT LIKE excludes matching patterns.
  • It works with LIKE wildcards.
  • It is useful for exclusion filtering.
  • NULL values need separate consideration.
  • Pattern performance depends on the wildcard position.
What does NOT LIKE do?

NOT LIKE returns values that do not match the specified text pattern.

Can NOT LIKE use wildcards?

Yes. NOT LIKE supports the same pattern-matching wildcards used by LIKE.

Have you finished this lesson?

Introduction to SQL – All Lessons