---
title: "What are the different conditions to filter records using LIKE operator?"  
description: "What are the different conditions to filter records using LIKE operator?"  
author: "Revati S Misra"  
published: 2023-12-21  
updated: 2025-03-03  
canonical: https://www.mindstick.com/forum/160544/what-are-the-different-conditions-to-filter-records-using-like-operator  
category: "mssql server"  
tags: ["mssql server", "sql server", "sql"]  
reading_time: 2 minutes  

---

# What are the different conditions to filter records using LIKE operator?

What are the different [conditions](https://www.mindstick.com/blog/394/javascript-if-else) to [filter](https://www.mindstick.com/forum/1176/filter-in-a-xml-file-in-c-sharp) [records using LIKE operator](https://www.mindstick.com/forum/160543/how-to-filter-records-using-like-operator-in-sql-server)?

## Replies

### Reply by Khushi Singh

SQL uses the LIKE [operator](https://www.mindstick.com/blog/144/union-intersection-and-except-operator-in-sql-server) to view [records](https://www.mindstick.com/forum/34640/how-to-create-a-stored-procedure-for-display-all-records) based on text pattern matches in specific database fields. The LIKE operator helps find particular text parts within database data. We use % and _ as the primary wildcard patterns when working with the LIKE operator.

The % wildcard expression matches zero or more characters at any position in a string search criteria. The expression WHERE `column_name` LIKE 'apple%' finds all values that start with the combination apple. LIKE '%tree' searches for values that end with the term tree. The expression LIKE '%book%' returns all values that include the word book anywhere within them.

The _ wildcard matches only one character in this context. The SQL statement WHERE `column_name` LIKE '`b_t`' finds words starting or ending with 'b' and followed by exactly one character 't' including bat, bit, and bot but not boat because it contains multiple characters between 'b' and 't'. SQL Server handles advanced pattern-matching procedures beyond base capabilities. The square bracket notation in the **LIKE** clause matches letters from a specific character set, including **WHERE** `column_name` `LIKE 'b[aeiou]t'` which finds both "bat" and "bit" results. Using the syntax like `c[^aeiou]t` matches only cat and cut strings while rejecting cit and cet matches because the brackets exclude specific letters and punctuation marks.

Databases differ in their way of handling text-matching sensitivity. Both MySQL and SQL Server perform case-insensitive LIKE searches automatically yet PostgreSQL demands usage of the ILIKE operator for this function. The LIKE operator needs proper indexing to work well on databases with many records. When SQL users understand these conditions they can enhance database searches by filtering results according to defined patterns.


---

Original Source: https://www.mindstick.com/forum/160544/what-are-the-different-conditions-to-filter-records-using-like-operator

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
