AND Operator in MySQL
In this tutorial, we are going to see how the AND operator combines multiple Boolean expressions to filter data. The AND operator is a logical operator that combines two or more Boolean expressions and returns true only if both expressions evaluate as true. The AND operator returns false if one of the two expressions evaluates to false.
Syntax:
Here is the syntax of the AND operator:
expression1 AND expression_2
Example:
The following query uses the AND operator to find customers located in Boston whose age is greater than 20:
SELECT * FROM Customers WHERE Address = 'Boston' AND Age > 20;
Output:
+----------+-----------+--------+-----------------------+ | ID | Name | age | Address | +----------+-----------+--------+-----------------------+ | 103 | Jean | 35 | Boston | | 104 | Bob | 40 | Boston | +----------+-----------+--------+-----------------------+