Raj Bhatt
What is SQL LIKE operator ?

The SQL LIKE operator is used in a WHERE clause to search for a specified pattern in a column.
It allows you to search for data that matches a specified pattern
The pattern can include two wildcard characters:

  1. % (percent sign) - matches zero, one, or multiple characters
  2. _ (underscore) - matches a single character
  1. SELECT * FROM employees
  2. WHERE name LIKE 'R%';

Query Will Search Name From Employees Table That Start With “R” And Return All Name Start With “R”

  1. SELECT * FROM employees
  2. WHERE name LIKE '%R';

Query Will Search Name From Employees Table That End With “R” And Return All Name End With “R”

  1. SELECT * FROM employees
  2. WHERE name LIKE '%R%';

Query Will Search Name From Employees Table That Have “R” In Any Position And Return All Name Having “R” In Any Position

  1. SELECT * FROM employees
  2. WHERE name LIKE '%A_';

Query Will Search Name From Employees Table Second Last Letter Of Name Is “A” Return All Name Which Having Second Last Letter With “A”

By Raj Bhatt in SQL on Feb 11 2023
  • Tuhin Paul
    Feb, 2023 14

    The SQL LIKE operator is used in a WHERE clause to match a specified pattern in a column of a table. It is often used with wildcard characters such as “%” to represent any sequence of characters, or “_” to represent any single character. The syntax for the LIKE operator is as follows:

    1. SELECT column_name
    2. FROM table_name
    3. WHERE column_name LIKE pattern;

    For example, the following query returns all rows from the “customers” table where the “city” column starts with “Londo”:

    1. SELECT * FROM customers
    2. WHERE city LIKE 'Londo%';

    • 0
  • Rajeev Kumar
    Feb, 2023 13

    The SQL LIKE condition allows you to use wildcards to perform pattern matching in a query. The LIKE condition is used in the WHERE clause of a SELECT statement.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS