• Articles
  • Tutorials
  • Interview Questions

LIKE Clause in SQL - A Comprehensive Guide

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

Wish to crack SQL job interviews? Intellipaat’s SQL Interview Questions are meant only for you!

Course Schedule

Name Date Details
SQL Training 20 Jul 2024(Sat-Sun) Weekend Batch
View Details
SQL Training 27 Jul 2024(Sat-Sun) Weekend Batch
View Details
SQL Training 03 Aug 2024(Sat-Sun) Weekend Batch
View Details

About the Author

Data Engineer

As a skilled Data Engineer, Sahil excels in SQL, Business Intelligence, and database management. He has contributed to projects at companies like Bajaj and Tata. With a background in software engineering, he crafted efficient solutions for data pipelines, analytics, and software integration, driving insights and innovation.