MySQL Wildcards

MySQL Wildcards

MySQL Aliases

MySQL Aliases

MySQL Data Types

MySQL Data Types

MySQL Interview Questions

MySQL Interview Questions and Answers


MySQL AND Operator

The MySQL AND operator is used with SELECT, INSERT, UPDATE or DELETE statements and return TRUE if two or more boolean expressions evaluate to true. The AND operator returns false if one of the two expressions evaluate to false. The AND operators are used to filter records based on more than one condition.

MySQL AND OPERATOR Syntax

To filter records based on more than one condition, use the following syntax:

Syntax

SELECT col1, col2, ...
FROM tablename
WHERE condition1 AND condition2 AND condition3 ...;  

Parameters:

tablename: The table name from which you want to fetch the records.

condition: To specifies multiple conditions that must be true to select records.

MySQL AND OPERATOR example

The following MySQL statement is used to filter records based on more than one condition is TRUE:

Example

SELECT firstName, lastName, address FROM tblCustomerLoan 
WHERE cellNo = 7897897890 AND lastName = 'Singh';

Note:

In the above example, we are showing how to use the AND operator to filter records based on more than one condition in SELECT statement.

You can use MySQL Command Line Client to filter records based on more than one condition is TRUE. It will look like this: