MySQL Like

 

The LIKE operator is used to check if a string contains another string.

These two wildcards are used with LIKE:
1. “%” – check for a match of one or more characters
2. “_” – check for a match of a single character

If you are searching for something that ends with a certain pattern of string then put % in the front.

If you are searching for something that starts with a certain pattern of string then put the % at the end.

If you are searching for something that contains a certain pattern of string no matter where it is in the string then put the % in the front and also at the end.

Here is an example of % where we are looking for vendor’s names that end with bay.

Here we are looking for vendor’s names that contain the letter a.

LIKE with _ wildcard

 

Here we are looking for vendor names that start with any character and end with bay.

 

Here we are looking for vendor names that start with E, followed by any character, followed by a, followed by any character.

 

 




Subscribe To Our Newsletter
You will receive our latest post and tutorial.
Thank you for subscribing!

required
required


Leave a Reply

Your email address will not be published.