PHP Tutorials
- What is MySqli
- mysql query
- mysql query example
- InnoDB
- mysql column Type
- CRUD Example
- Connection Using Function
- mysql keys
- SELECT
- WHERE
- UPDATE
- Count no of Rows
- ALIAS
- AND, AND & OR
- BETWEEN
- COMPARISON OPERATOR
- DELETE
- DELETE LIMIT
- DISTINCT
- EXISTS
- FROM
- GROUP BY
- HAVING
- IN
- INTERSECT
- IS NULL & IS NOT NULL
- LIKE
- NOT
- ORDER BY
- SELECT LIMIT
- SUBQUERY
- TRUNCATE
- UNION && UNION ALL
- Concat & Group_Concat
- mysql Function
- Mysql Insert Id
- MySql Aggregate Function
- Mysql Join
- JOIN in MySql
- Trigger
- Procedure
- Transaction
- views
- Index
- SQL Injection
- Normalization
- Query Bind
- Interview Questions
Important Link
what is mysql like?
Like
The LIKE operator is used in a WHERE clause to search for a specific pattern in a column.
There are two wildcards used with the LIKE operator:
The percent sign (%) represents zero, one, or multiple characters
The underscore sign (_) represents one, single character
You can combine any number of conditions using AND or OR operators.
File Name :
SELECT * FROM ittutorial WHERE tutorial LIKE '%php%';
File Name :
WHERE CustomerName LIKE 'a%' Finds any values that start with "a"
WHERE CustomerName LIKE '%a' Finds any values that end with "a"
WHERE CustomerName LIKE '%or%' Finds any values that have "or" in any position
WHERE CustomerName LIKE '_r%' Finds any values that have "r" in the second position
WHERE CustomerName LIKE 'a_%' Finds any values that start with "a" and are at least 2 characters in length
WHERE CustomerName LIKE 'a__%' Finds any values that start with "a" and are at least 3 characters in length
WHERE ContactName LIKE 'a%o' Finds any values that start with "a" and ends with "o"
File Name :
SELECT * FROM ittutorial WHERE tutorial LIKE 'p%';
SELECT * FROM ittutorial WHERE tutorial LIKE '%java';
Like
The LIKE Operator used with the WHERE clause to search for a specific pattern in a string. The string pattern contains wildcard characters that represent missing characters.
SELECT * FROM ittutorial WHERE name course '%P';
// Here the percentage sign is a wildcard character.
Fetch all the employees whose name ends with ab.
This means return all records whose name ends with the string ‘ab’.
SELECT * FROM ittutorial WHERE tutorial name '%ab';
Fetch all employee whose name contains the word 'ma'
the following like statement return all the users from the users table where the Name containing the word ‘ma’ anywhere in the name column
SELECT * FROM Users WHERE Name LIKE ‘%ma%’;
NOT LIKE Operator
Fetch all the users whose name does not start with m.
SELECT * FROM users WHERE Name NOT LIKE ‘m%’;
Fetch all users whose name does not contain the word sa
SELECT * FROM users WHERE Name NOT LIKE ‘%sa%’;