Beginner

367. LIKE Ends With

Learn how to find text values that end with a specific pattern.

📘 Lesson 367 of 728 ⏱ 8 min 🎯 Beginner

A LIKE pattern beginning with % can be used to find text values that end with a specified sequence of characters.

Suffix searches are useful for identifying file extensions, email domains, product codes, names, and other ending patterns.

Find email addresses ending with '@company.com'.

SQL
SELECT
    Email
FROM Customers
WHERE Email LIKE '%@company.com';

Analysts can use suffix matching for email domains, account codes, product identifiers, and data-quality checks.

  • % before the pattern allows preceding characters.
  • The specified text must appear at the end.
  • It is useful for suffix searches.
  • Leading wildcards can reduce index efficiency.
  • Database collation can affect text matching.
How do you find values ending with .com?

Use a pattern such as LIKE '%.com'.

What does % before a pattern mean?

It allows zero or more characters before the specified pattern.

Have you finished this lesson?

Introduction to SQL – All Lessons