Hi! This is Ashutosh Kumar Verma. I am a software developer at MindStick Software Pvt Ltd since 2021. I have added some new and interesting features to the MindStick website like a story section, audio section, and merge profile feature on MindStick subdomains, etc. I love coding and I have good knowledge of SQL Database.
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 People table that contains ‘A’ in the column FirstName
Ashutosh Kumar Verma
18-Jul-2024SQL 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
People
table that contains ‘A’ in the columnFirstName
Also, Read: What are SQL Clauses and Operators?