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;

 

About the Author

Technical Writer | Business Analyst

Yash Vardhan Gupta is an expert in data and business analysis, skilled at turning complex data into clear and actionable insights. He works with tools like Power BI, Tableau, SQL, and Markdown to develop effective documentation, including SRS and BRD. He helps teams interpret data, make informed decisions, and drive better business outcomes. He is also passionate about sharing his expertise in a simple and understandable way to help others learn and apply it effectively.