MySQL - IN Conditions and LIKE Conditions in MySQL

IN Conditions and LIKE Conditions in MySQL

IN condition is used to match specified values in a query.

Example:-
SELECT * FROM employee
where EmployeeID IN(226,211)
will return rows with ID 226 and 211.
LIKE

LIKE clause is used for pattern matching. It is used in the WHERE clause.

“%” is used as a wild card.
? S% - returns strings starting with S.
? %S - returns strings ending with S.
? %sas% - returns strings with substring as sas.

Example:
SELECT * FROM Employee WHERE City LIKE 's%'
MySQL - Regular expression pattern condition: REGEXP in MySQL
Regular expression pattern condition: REGEXP in MySQL - REGEXP is used to match a string against a specified pattern. There are different operators used to match patterns......
MySQL - Explain CASE Expression in MySQL with syntax
Explain CASE Expression in MySQL with syntax - CASE statement is a conditional expression. It is used to execute specific statements when some search condition evaluates to TRUE......
MySQL - TIMESTAMP data type in MySQL
TIMESTAMP data type in MySQL - A TIMESTAMP data type allows you to record a date and time like DATETIME data.....
Post your comment