mysql in operator code example

Example 1: mysql is in list

SELECT 
    column1,column2,...
FROM
    table_name
WHERE 
	(expr|column_1) IN ('value1','value2',...);

Example 2: MySQL AND Operator

The AND operator is a logical operator that combines two or more Boolean expressions and returns true only if both expressions evaluate to true. The AND operator returns false if one of the two expressions evaluate to false.

Here is the syntax of the AND operator:

SELECT 
    customername, 
    country, 
    state
FROM
    customers
WHERE
    country = 'USA' AND state = 'CA';

Example 3: operator in mysql

SELECT * FROM `tableName` WHERE `ColumnName` IN (1,2,3);

Tags:

Sql Example