Web Developer
I am a professional .NET developer with over 4 years of hands-on industry experience in designing, developing, and maintaining scalable web applications. I specialize in .NET Core, C#, RESTful APIs, and database-driven systems using SQL Server.
SQL LIKE Operator
The SQL LIKE function, with its wildcards, is used to match patterns in queries. Allows you to search for values that match a specific pattern in a column. This is useful when you want to see a partial similarity between data or records in a particular sample.
Wildcards used are ‘LIKE’
‘
%’- Represents zero or more characters. For example, LIKE 'A%' matches any value starting with 'A'.‘
%%’- Represents zero or more characters. e.g. LIKE ‘%A%’ matches all values that contain ‘A’‘_’- Represents a single character. For example, LIKE 'A_ _' matches any three-character value beginning with 'A'.‘
[]’- Represents any single character within the brackets.‘
^’- Represents any character not within the brackets.Example-
This query retrieves all the rows from the
Peopletable that contains ‘A’ in the columnFirstNameAlso, Read: What are SQL Clauses and Operators?