MySQL AND

In MySQL the Logical operator AND returns true only if the expressions linked by it evaluates to true. If we are using the AND operator in the WHERE clause, then the query will return only those rows for which all the conditions specified in the WHERE clause evaluates to true.

MySQL AND Logical operator Syntax

Below is the Basic Syntax of AND Logical operator in the WHERE clause of a SELECT statement:

MySQL AND Logical operator Examples

To demonstrate the MySQL AND Logical Operator, let us create a Player Table with sample records as depicted in the below image by executing the following script.

player-demo-table

Example 1: MySql AND Logical operator

We can write a query like below to get all the Players whose State is New York and has born after 1934

RESULT:
mysql-and-ex1

Example 2: MySql AND Logical operator

We can write a query like below to get all the Players whose State is not New York and has born after 1934

RESULT:
mysql-and-ex2

Leave a Reply

Your email address will not be published. Required fields are marked *