PHP MySQL LIKE operator string Function

PHP MySQL LIKE operator string Function

Today, We want to share with you PHP MySQL LIKE operator string Function.
In this post we will show you Using MySQL LIKE Operator to Select Data, hear for How to use PHP string in mySQL LIKE query? we will give you demo and example for implement.
In this post, we will learn about MySQL not like operator string function with an example.

This MY Very Useful POST covers all the detailed information about how to use LIKE and comparison operator with SELECT statement in MySQL and Example.

List of MySQL LIKE operator examples

MySQL LIKE with percentage (%) wildcard

SELECT 
    username, age, mobileno
FROM
    users
WHERE
    username LIKE 'j%';
SELECT 
    username, age, mobileno
FROM
    users
WHERE
    username LIKE '%on';
SELECT 
    usernumber, username, usercast
FROM
    usermst
WHERE
    username LIKE '%on%';

MySQL LIKE with underscore( _ ) wildcard

SELECT 
    studnumber, studname, studage
FROM
    students
WHERE
    studname LIKE 'T_m';

MySQL LIKE operator with NOT operator

SELECT 
    postnumber, postName, postdesc
FROM
    blogers
WHERE
    postName NOT LIKE 'B%';

MySQL LIKE with where and ESCAPE clause

SELECT 
    postCode, postName
FROM
    blogger
WHERE
    postCode LIKE '%\_20%';
SELECT 
     postCode, postName
FROM
    blogger
WHERE
    postCode LIKE '%$_20%' ESCAPE '$';

Mysql Like multiple values

[PHP]
WHERE schools LIKE ‘%username%’ OR schools LIKE ‘%std%’

Multiple LIKE values

WHERE schools REGEXP 'username|std'
SELECT * FROM tablename WHERE schools REGEXP 'username|std'
SELECT * from yourtablename where fieldname REGEXP '9898|2250|7689'; 

multi-argument MySQL Search Query

SELECT * FROM fiberbox WHERE field REGEXP '^1740 |1938 $|1940 (.*) test';

Multiple Argument Search in mysql Explain

^ in front of the search value indicates startipakainfo of the line.
$ after the search value indicates endipakainfo of line.
(.*) behaves much like operators the % wildcard.
The . indicates see any like as a sipakainfole character search, except line end breaks. Placipakainfo . inside character () with * (.*) adds a character repeatipakainfo pattern indicatipakainfo any type number of characters till endipakainfo of the line.

SQL search multiple values in same field

we can used to SQL simple IN operator to insted of Like operator to search multiple absolute values:

SELECT username FROM students WHERE username IN ( 'class', 'std', ... );

Like with the results of a subquery

SELECT u1.field1, u1.field2, u1.field3 
FROM
    usermst u1
    JOIN
    (SELECT distinct field AS fieldx from lapakainfomst) l2 
    ON u1.field3 like CONCAT('%',fieldx,'%')

Like ALL in mysql with Example

SELECT * FROM pakainfo WHERE apakainfoular NOT LIKE ALL(ARRAY[my values]);

Development

We hope you get an idea about MySQL LIKE Operator
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.

Leave a Comment