• Articles
  • Tutorials
  • Interview Questions

LIKE Clause in SQL - A Comprehensive Guide

Tutorial Playlist

The LIKE operator in SQL is used to search for patterns in strings. This can be useful when you want to find rows that match a certain criteria, such as a specific name or a phone number. In this blog post, we’ll show you how to use the LIKE operator, and we’ll even give you some examples of how to use it in your own queries.

How to search a specified pattern in a column in SQL?

It is used to search a specified pattern in a column. The two wildcards operator used in conjunction with the LIKE operator.

  • % – The percent sign is used to represent one or more characters.
  • _ – The underscore sign is used to represent only one Character.

Syntax:

SELECT column1, column2….
FROM table_name
WHERE column1 LIKE %XXX;
‘OR’
SELECT column1, column2….
FROM table_name
WHERE column1 LIKE %XXX%;
‘OR’
 
SELECT column1, column2….
FROM table_name
WHERE column1 LIKE _XXX;
‘OR’
SELECT column1, column2….
FROM table_name
WHERE column1 LIKE XX_X;
‘OR’
SELECT column1, column2….
FROM table_name
WHERE column1 LIKE %XX_X;
Example:
SELECT Name, Roll_no
FROM Student_details
WHERE Name LIKE %tesh;

 

Name Roll No.
Jitesh 6

Become a Database Architect

Get a comprehensive overview of how SQL INNER JOIN works, with examples and illustrations!

Course Schedule

Name Date Details
SQL Training 20 Apr 2024(Sat-Sun) Weekend Batch
View Details
SQL Training 27 Apr 2024(Sat-Sun) Weekend Batch
View Details
SQL Training 04 May 2024(Sat-Sun) Weekend Batch
View Details

Database-ad.jpg