Beginner

30. LIKE Operator

Learn how the LIKE operator searches for text patterns in SQL.

📘 Lesson 30 of 728 ⏱ 8 min 🎯 Beginner

The LIKE operator is used to search for a specified pattern within text values. It is commonly used with wildcard characters such as % and _. The percent sign (%) represents zero or more characters, while the underscore (_) generally represents a single character.

Business data often requires partial text searches. Analysts may need to find customers whose names start with a particular letter, products containing a specific word, or email addresses from a particular domain.

If you want to find employees whose names start with the letter 'A', you can use LIKE with the pattern 'A%'.

SQL
SELECT
    EmployeeName
FROM Employees
WHERE EmployeeName LIKE 'A%';

LIKE is used for customer searches, employee searches, product analysis, address filtering, data-quality checks, and text-based reporting.

  • LIKE searches for text patterns.
  • % represents zero or more characters.
  • _ generally represents one character.
  • LIKE is commonly used with WHERE.
  • LIKE is useful for partial text searches.
What is LIKE used for in SQL?

LIKE is used to search text values based on a specified pattern.

What does % mean in a LIKE pattern?

% represents zero or more characters in a LIKE pattern.

Have you finished this lesson?

Introduction to SQL – All Lessons